StructDeclaration
Go struct declaration.
Properties for creating a struct declaration.
This can be used for both named and anonymous structs.
For named structs, use StructTypeDeclarationProps instead.
import { StructDeclaration } from "@alloy-js/go";
<StructDeclaration refkey={Refkey} singleLine> {children}</StructDeclaration>import { StructDeclaration } from "@alloy-js/go/stc";
StructDeclaration({ refkey: Refkey, singleLine: boolean }).children(children)| children | optional Children | |
| refkey | optional Refkey | |
| singleLine | optional boolean | Whether to render the struct in a single line. This will only compile if children is a single line as well. This is not common in Go, so use with caution. |
Example
Section titled “Example”<StructDeclaration>
<StructEmbed pointer>{MyOtherStruct}</StructEmbed>
<StructMember exported name="MyProperty" type="int" />
</StructDeclaration>
This will produce:
struct {
MyOtherStruct
MyProperty int
}