Skip to content

Build Template interfaces.

Cheikh Seck edited this page Sep 12, 2017 · 1 revision

Build template interfaces

step1

  1. Click on Interfaces within your project tree.

Save

step2

  1. Click on the yellow save button or use (ctrl-s | cmd-s)

Controls

step3

  1. Multi-purpose text field. Text used to search for an interface and new interface name. step4
  2. Click on the button with the + (plus) symbol to create a new interface ( with multi-purpose field filled). step1
  3. Click on the button with search symbol to search for an interface ( with multi-purpose field filled). You can always use (ctrl-f | cmd-f)

About structs tag

The <struct/> tag will declare a new Go interface within within your generated Go src.

Attributes

  • name - The name of this structure
  • Innerxml - Struct field declarations.

The example below declares a Go struct named DemoGos with a sub structure called DemoChild. The struct DemoGos has attributes SomeAttr and Child.

Whenever this interface is initialized within a template ({{ $var := Struct_name }}), these variables are accessible as that interface's properties.

<gos>
	...
		<struct name="DemoChild">
			SomeOtherAttr string
		</struct>
		<struct name="DemoGos">
			SomeAttr string
			Child *DemoChild
		</struct>
	...
</gos>

Template init with prior example : {{ $var := DemoGos }}