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 | optionalChildren |
| refkey | optionalRefkey |
| singleLine | optionalbooleanWhether to render the struct in a single line.
This will only compile if |
Example
Section titled “Example”<StructDeclaration> <StructEmbed pointer>{MyOtherStruct}</StructEmbed> <StructMember exported name="MyProperty" type="int" /></StructDeclaration>This will produce:
struct { MyOtherStruct MyProperty int}