@alloy-js/go 0.3.0-dev.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/dev/src/builtins/fmt/fmt.js +148 -0
  3. package/dist/dev/src/builtins/fmt/fmt.js.map +1 -0
  4. package/dist/dev/src/builtins/index.js +11 -0
  5. package/dist/dev/src/builtins/index.js.map +1 -0
  6. package/dist/dev/src/builtins/io/io.js +650 -0
  7. package/dist/dev/src/builtins/io/io.js.map +1 -0
  8. package/dist/dev/src/builtins/net/net.js +1212 -0
  9. package/dist/dev/src/builtins/net/net.js.map +1 -0
  10. package/dist/dev/src/builtins/time/time.js +464 -0
  11. package/dist/dev/src/builtins/time/time.js.map +1 -0
  12. package/dist/dev/src/components/ImportStatement.js +114 -0
  13. package/dist/dev/src/components/ImportStatement.js.map +1 -0
  14. package/dist/dev/src/components/ModuleDirectory.js +28 -0
  15. package/dist/dev/src/components/ModuleDirectory.js.map +1 -0
  16. package/dist/dev/src/components/Name.js +12 -0
  17. package/dist/dev/src/components/Name.js.map +1 -0
  18. package/dist/dev/src/components/Reference.js +15 -0
  19. package/dist/dev/src/components/Reference.js.map +1 -0
  20. package/dist/dev/src/components/SourceDirectory.js +38 -0
  21. package/dist/dev/src/components/SourceDirectory.js.map +1 -0
  22. package/dist/dev/src/components/SourceFile.js +119 -0
  23. package/dist/dev/src/components/SourceFile.js.map +1 -0
  24. package/dist/dev/src/components/doc/comment.js +46 -0
  25. package/dist/dev/src/components/doc/comment.js.map +1 -0
  26. package/dist/dev/src/components/doc/comment.test.js +371 -0
  27. package/dist/dev/src/components/doc/comment.test.js.map +1 -0
  28. package/dist/dev/src/components/function/function.js +250 -0
  29. package/dist/dev/src/components/function/function.js.map +1 -0
  30. package/dist/dev/src/components/function/function.test.js +630 -0
  31. package/dist/dev/src/components/function/function.test.js.map +1 -0
  32. package/dist/dev/src/components/index.js +16 -0
  33. package/dist/dev/src/components/index.js.map +1 -0
  34. package/dist/dev/src/components/interface/declaration.js +245 -0
  35. package/dist/dev/src/components/interface/declaration.js.map +1 -0
  36. package/dist/dev/src/components/interface/interface.test.js +853 -0
  37. package/dist/dev/src/components/interface/interface.test.js.map +1 -0
  38. package/dist/dev/src/components/package.test.js +137 -0
  39. package/dist/dev/src/components/package.test.js.map +1 -0
  40. package/dist/dev/src/components/parameters/parameters.js +102 -0
  41. package/dist/dev/src/components/parameters/parameters.js.map +1 -0
  42. package/dist/dev/src/components/parameters/typeparameters.js +93 -0
  43. package/dist/dev/src/components/parameters/typeparameters.js.map +1 -0
  44. package/dist/dev/src/components/pointer/pointer.js +8 -0
  45. package/dist/dev/src/components/pointer/pointer.js.map +1 -0
  46. package/dist/dev/src/components/stc/index.js +27 -0
  47. package/dist/dev/src/components/stc/index.js.map +1 -0
  48. package/dist/dev/src/components/struct/declaration.js +213 -0
  49. package/dist/dev/src/components/struct/declaration.js.map +1 -0
  50. package/dist/dev/src/components/struct/struct.test.js +1261 -0
  51. package/dist/dev/src/components/struct/struct.test.js.map +1 -0
  52. package/dist/dev/src/components/type/declaration.js +112 -0
  53. package/dist/dev/src/components/type/declaration.js.map +1 -0
  54. package/dist/dev/src/components/var/declaration.js +136 -0
  55. package/dist/dev/src/components/var/declaration.js.map +1 -0
  56. package/dist/dev/src/components/var/var-declaration.test.js +564 -0
  57. package/dist/dev/src/components/var/var-declaration.test.js.map +1 -0
  58. package/dist/dev/src/context/package.js +6 -0
  59. package/dist/dev/src/context/package.js.map +1 -0
  60. package/dist/dev/src/create-module.js +157 -0
  61. package/dist/dev/src/create-module.js.map +1 -0
  62. package/dist/dev/src/create-module.test.js +175 -0
  63. package/dist/dev/src/create-module.test.js.map +1 -0
  64. package/dist/dev/src/index.js +7 -0
  65. package/dist/dev/src/index.js.map +1 -0
  66. package/dist/dev/src/name-policy.js +27 -0
  67. package/dist/dev/src/name-policy.js.map +1 -0
  68. package/dist/dev/src/scopes/contexts.js +34 -0
  69. package/dist/dev/src/scopes/contexts.js.map +1 -0
  70. package/dist/dev/src/scopes/factories.js +17 -0
  71. package/dist/dev/src/scopes/factories.js.map +1 -0
  72. package/dist/dev/src/scopes/function.js +14 -0
  73. package/dist/dev/src/scopes/function.js.map +1 -0
  74. package/dist/dev/src/scopes/go.js +12 -0
  75. package/dist/dev/src/scopes/go.js.map +1 -0
  76. package/dist/dev/src/scopes/index.js +10 -0
  77. package/dist/dev/src/scopes/index.js.map +1 -0
  78. package/dist/dev/src/scopes/lexical.js +11 -0
  79. package/dist/dev/src/scopes/lexical.js.map +1 -0
  80. package/dist/dev/src/scopes/module.js +31 -0
  81. package/dist/dev/src/scopes/module.js.map +1 -0
  82. package/dist/dev/src/scopes/named-type.js +33 -0
  83. package/dist/dev/src/scopes/named-type.js.map +1 -0
  84. package/dist/dev/src/scopes/package.js +39 -0
  85. package/dist/dev/src/scopes/package.js.map +1 -0
  86. package/dist/dev/src/scopes/source-file.js +43 -0
  87. package/dist/dev/src/scopes/source-file.js.map +1 -0
  88. package/dist/dev/src/symbols/factories.js +165 -0
  89. package/dist/dev/src/symbols/factories.js.map +1 -0
  90. package/dist/dev/src/symbols/function.js +24 -0
  91. package/dist/dev/src/symbols/function.js.map +1 -0
  92. package/dist/dev/src/symbols/go.js +60 -0
  93. package/dist/dev/src/symbols/go.js.map +1 -0
  94. package/dist/dev/src/symbols/index.js +7 -0
  95. package/dist/dev/src/symbols/index.js.map +1 -0
  96. package/dist/dev/src/symbols/named-type.js +42 -0
  97. package/dist/dev/src/symbols/named-type.js.map +1 -0
  98. package/dist/dev/src/symbols/package.js +39 -0
  99. package/dist/dev/src/symbols/package.js.map +1 -0
  100. package/dist/dev/src/symbols/reference.js +76 -0
  101. package/dist/dev/src/symbols/reference.js.map +1 -0
  102. package/dist/dev/src/symbols/type-parameter.js +16 -0
  103. package/dist/dev/src/symbols/type-parameter.js.map +1 -0
  104. package/dist/dev/test/utils.js +92 -0
  105. package/dist/dev/test/utils.js.map +1 -0
  106. package/dist/dev/test/vitest.setup.js +2 -0
  107. package/dist/dev/test/vitest.setup.js.map +1 -0
  108. package/dist/tsconfig.tsbuildinfo +1 -1
  109. package/docs/api/components/FunctionDeclaration.md +53 -0
  110. package/docs/api/components/FunctionParameter.md +40 -0
  111. package/docs/api/components/FunctionParameters.md +29 -0
  112. package/docs/api/components/FunctionReceiver.md +38 -0
  113. package/docs/api/components/ImportStatements.md +25 -0
  114. package/docs/api/components/InterfaceDeclaration.md +54 -0
  115. package/docs/api/components/InterfaceEmbed.md +29 -0
  116. package/docs/api/components/InterfaceFunction.md +41 -0
  117. package/docs/api/components/InterfaceTypeDeclaration.md +56 -0
  118. package/docs/api/components/LineComment.md +29 -0
  119. package/docs/api/components/ModuleDirectory.md +29 -0
  120. package/docs/api/components/Name.md +19 -0
  121. package/docs/api/components/Pointer.md +29 -0
  122. package/docs/api/components/Reference.md +25 -0
  123. package/docs/api/components/SingleImportStatement.md +35 -0
  124. package/docs/api/components/SourceDirectory.md +27 -0
  125. package/docs/api/components/SourceFile.md +44 -0
  126. package/docs/api/components/StructDeclaration.md +51 -0
  127. package/docs/api/components/StructEmbed.md +29 -0
  128. package/docs/api/components/StructMember.md +41 -0
  129. package/docs/api/components/StructTypeDeclaration.md +56 -0
  130. package/docs/api/components/TypeConstraint.md +28 -0
  131. package/docs/api/components/TypeDeclaration.md +47 -0
  132. package/docs/api/components/TypeDeclarationGroup.md +27 -0
  133. package/docs/api/components/TypeParameter.md +37 -0
  134. package/docs/api/components/TypeParameters.md +25 -0
  135. package/docs/api/components/VariableDeclaration.md +44 -0
  136. package/docs/api/components/VariableDeclarationGroup.md +28 -0
  137. package/docs/api/components/index.md +30 -0
  138. package/docs/api/contexts/TypeDeclarationGroup-context.md +17 -0
  139. package/docs/api/contexts/VariableDeclarationGroup-context.md +18 -0
  140. package/docs/api/contexts/index.md +4 -0
  141. package/docs/api/functions/createAnonymousTypeSymbol.md +25 -0
  142. package/docs/api/functions/createFunctionScope.md +26 -0
  143. package/docs/api/functions/createFunctionSymbol.md +35 -0
  144. package/docs/api/functions/createGoModuleScope.md +18 -0
  145. package/docs/api/functions/createGoNamePolicy.md +17 -0
  146. package/docs/api/functions/createGoPackageScope.md +18 -0
  147. package/docs/api/functions/createInterfaceMemberSymbol.md +25 -0
  148. package/docs/api/functions/createModule.md +20 -0
  149. package/docs/api/functions/createNamedTypeScope.md +27 -0
  150. package/docs/api/functions/createNestedStructSymbol.md +26 -0
  151. package/docs/api/functions/createPackageSymbol.md +19 -0
  152. package/docs/api/functions/createParameterSymbol.md +36 -0
  153. package/docs/api/functions/createPropertySymbol.md +34 -0
  154. package/docs/api/functions/createStructMemberSymbol.md +25 -0
  155. package/docs/api/functions/createTypeParameterSymbol.md +25 -0
  156. package/docs/api/functions/createTypeSymbol.md +26 -0
  157. package/docs/api/functions/createVariableSymbol.md +34 -0
  158. package/docs/api/functions/index.md +29 -0
  159. package/docs/api/functions/ref.md +18 -0
  160. package/docs/api/functions/useEnclosingPackageScope.md +17 -0
  161. package/docs/api/functions/useFuncScope.md +17 -0
  162. package/docs/api/functions/useGoNamePolicy.md +17 -0
  163. package/docs/api/functions/useGoScope.md +17 -0
  164. package/docs/api/functions/useLexicalScope.md +17 -0
  165. package/docs/api/functions/useModule.md +17 -0
  166. package/docs/api/functions/useNamedTypeScope.md +17 -0
  167. package/docs/api/functions/usePackage.md +17 -0
  168. package/docs/api/functions/useSourceFileScope.md +17 -0
  169. package/docs/api/index.md +7 -0
  170. package/docs/api/types/CreateTypeParameterSymbolOptions.md +9 -0
  171. package/docs/api/types/Descriptor.md +5 -0
  172. package/docs/api/types/EmbedDescriptor.md +9 -0
  173. package/docs/api/types/FieldDescriptor.md +9 -0
  174. package/docs/api/types/FunctionDescriptor.md +9 -0
  175. package/docs/api/types/FunctionSymbol.md +13 -0
  176. package/docs/api/types/GoElements.md +5 -0
  177. package/docs/api/types/GoFunctionScope.md +12 -0
  178. package/docs/api/types/GoLexicalScope.md +11 -0
  179. package/docs/api/types/GoModuleScope.md +10 -0
  180. package/docs/api/types/GoNamedTypeScope.md +16 -0
  181. package/docs/api/types/GoPackageScope.md +10 -0
  182. package/docs/api/types/GoScope.md +10 -0
  183. package/docs/api/types/GoSourceFileScope.md +13 -0
  184. package/docs/api/types/GoSymbol.md +17 -0
  185. package/docs/api/types/GoSymbolKinds.md +5 -0
  186. package/docs/api/types/GoSymbolOptions.md +10 -0
  187. package/docs/api/types/ImportRecords.md +5 -0
  188. package/docs/api/types/InterfaceDescriptor.md +9 -0
  189. package/docs/api/types/LibraryFrom.md +5 -0
  190. package/docs/api/types/MemberDescriptor.md +8 -0
  191. package/docs/api/types/MethodDescriptor.md +9 -0
  192. package/docs/api/types/NamedTypeDescriptor.md +8 -0
  193. package/docs/api/types/NamedTypeSymbol.md +17 -0
  194. package/docs/api/types/NamedTypeSymbolKind.md +5 -0
  195. package/docs/api/types/NamedTypeSymbolOptions.md +9 -0
  196. package/docs/api/types/NamedTypeTypeKind.md +5 -0
  197. package/docs/api/types/PackageDescriptor.md +12 -0
  198. package/docs/api/types/PackageSymbol.md +15 -0
  199. package/docs/api/types/PackageSymbolOptions.md +10 -0
  200. package/docs/api/types/ResolveDescriptor.md +7 -0
  201. package/docs/api/types/SourceFileHeaderProps.md +9 -0
  202. package/docs/api/types/StrictDescriptor.md +5 -0
  203. package/docs/api/types/StructDescriptor.md +9 -0
  204. package/docs/api/types/TypeDescriptor.md +9 -0
  205. package/docs/api/types/VariableDescriptor.md +9 -0
  206. package/docs/api/types/index.md +38 -0
  207. package/docs/api/variables/index.md +3 -0
  208. package/docs/api/variables/std.md +2463 -0
  209. package/package.json +10 -7
  210. package/vitest.config.ts +8 -0
@@ -0,0 +1,53 @@
1
+ # FunctionDeclaration
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { FunctionDeclaration } from "@alloy-js/go";
7
+
8
+
9
+ <FunctionDeclaration
10
+ doc={Children}
11
+ name={string | Namekey}
12
+ parameters={FunctionParameterProps[]}
13
+ receiver={Children}
14
+ refkey={Refkey}
15
+ returns={Children}
16
+ singleLine
17
+ typeParameters={TypeParameterProps[]}
18
+ >
19
+ {children}
20
+ </FunctionDeclaration>
21
+ ```
22
+
23
+ * stc
24
+
25
+ ```ts
26
+ import { FunctionDeclaration } from "@alloy-js/go/stc";
27
+
28
+
29
+ FunctionDeclaration({
30
+ doc: Children,
31
+ name: string | Namekey,
32
+ parameters: FunctionParameterProps[],
33
+ receiver: Children,
34
+ refkey: Refkey,
35
+ returns: Children,
36
+ singleLine: boolean,
37
+ typeParameters: TypeParameterProps[],
38
+ }).children(children)
39
+ ```
40
+
41
+ ## Props
42
+
43
+ | | | |
44
+ | -------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | children | optional [Children](../../../core/types/children/) | |
46
+ | doc | optional [Children](../../../core/types/children/) | Doc comment |
47
+ | name | string \| [Namekey](../../../core/types/namekey/) | |
48
+ | parameters | optional [FunctionParameterProps](../functionparameter/)\[] | |
49
+ | receiver | optional [Children](../../../core/types/children/) | Go receiver (for methods) |
50
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
51
+ | returns | optional [Children](../../../core/types/children/) | |
52
+ | singleLine | optional boolean | Whether to render the function 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. |
53
+ | typeParameters | optional [TypeParameterProps](../typeparameter/)\[] | Type parameters for generic functions |
@@ -0,0 +1,40 @@
1
+ # FunctionParameter
2
+
3
+ Define a parameter to be used in functions.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FunctionParameter } from "@alloy-js/go";
9
+
10
+
11
+ <FunctionParameter
12
+ name={string | Namekey}
13
+ refkey={Refkey}
14
+ type={Children}
15
+ variadic
16
+ />
17
+ ```
18
+
19
+ * stc
20
+
21
+ ```ts
22
+ import { FunctionParameter } from "@alloy-js/go/stc";
23
+
24
+
25
+ FunctionParameter({
26
+ name: string | Namekey,
27
+ refkey: Refkey,
28
+ type: Children,
29
+ variadic: boolean,
30
+ }).children(children)
31
+ ```
32
+
33
+ ## Props
34
+
35
+ | | | |
36
+ | -------- | ------------------------------------------------- | - |
37
+ | name | string \| [Namekey](../../../core/types/namekey/) | |
38
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
39
+ | type | [Children](../../../core/types/children/) | |
40
+ | variadic | optional boolean | |
@@ -0,0 +1,29 @@
1
+ # FunctionParameters
2
+
3
+ Render a collection of parameters
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FunctionParameters } from "@alloy-js/go";
9
+
10
+
11
+ <FunctionParameters parameters={FunctionParameterProps[] | undefined} />
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { FunctionParameters } from "@alloy-js/go/stc";
18
+
19
+
20
+ FunctionParameters({
21
+ parameters: FunctionParameterProps[] | undefined,
22
+ }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | ---------- | --------------------------------------------------------------- | - |
29
+ | parameters | [FunctionParameterProps](../functionparameter/)\[] \| undefined | |
@@ -0,0 +1,38 @@
1
+ # FunctionReceiver
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { FunctionReceiver } from "@alloy-js/go";
7
+
8
+
9
+ <FunctionReceiver
10
+ name={string | Namekey}
11
+ refkey={Refkey}
12
+ type={Children}
13
+ typeParameters={TypeParameterProps[]}
14
+ />
15
+ ```
16
+
17
+ * stc
18
+
19
+ ```ts
20
+ import { FunctionReceiver } from "@alloy-js/go/stc";
21
+
22
+
23
+ FunctionReceiver({
24
+ name: string | Namekey,
25
+ refkey: Refkey,
26
+ type: Children,
27
+ typeParameters: TypeParameterProps[],
28
+ }).children(children)
29
+ ```
30
+
31
+ ## Props
32
+
33
+ | | | |
34
+ | -------------- | --------------------------------------------------- | - |
35
+ | name | string \| [Namekey](../../../core/types/namekey/) | |
36
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
37
+ | type | [Children](../../../core/types/children/) | |
38
+ | typeParameters | optional [TypeParameterProps](../typeparameter/)\[] | |
@@ -0,0 +1,25 @@
1
+ # ImportStatements
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { ImportStatements } from "@alloy-js/go";
7
+
8
+
9
+ <ImportStatements records={ImportRecords} />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { ImportStatements } from "@alloy-js/go/stc";
16
+
17
+
18
+ ImportStatements({ records: ImportRecords }).children(children)
19
+ ```
20
+
21
+ ## Props
22
+
23
+ | | | |
24
+ | ------- | ------------------------------------------- | - |
25
+ | records | [ImportRecords](../../types/importrecords/) | |
@@ -0,0 +1,54 @@
1
+ # InterfaceDeclaration
2
+
3
+ Go interface declaration.
4
+
5
+ Properties for creating an interface declaration. This can be used for both named and anonymous interfaces. For named interfaces, use `InterfaceTypeDeclarationProps` instead.
6
+
7
+ * jsx
8
+
9
+ ```tsx
10
+ import { InterfaceDeclaration } from "@alloy-js/go";
11
+
12
+
13
+ <InterfaceDeclaration refkey={Refkey} singleLine>
14
+ {children}
15
+ </InterfaceDeclaration>
16
+ ```
17
+
18
+ * stc
19
+
20
+ ```ts
21
+ import { InterfaceDeclaration } from "@alloy-js/go/stc";
22
+
23
+
24
+ InterfaceDeclaration({
25
+ refkey: Refkey,
26
+ singleLine: boolean,
27
+ }).children(children)
28
+ ```
29
+
30
+ ## Props
31
+
32
+ | | | |
33
+ | ---------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | children | optional [Children](../../../core/types/children/) | |
35
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
36
+ | singleLine | optional boolean | Whether to render the interface 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. |
37
+
38
+ ## Example
39
+
40
+ ```tsx
41
+ <InterfaceDeclaration>
42
+ <InterfaceEmbed>{MyOtherInterface}</InterfaceEmbed>
43
+ <InterfaceFunction name="MyFunc" parameters={params} returns="int" />
44
+ </InterfaceDeclaration>
45
+ ```
46
+
47
+ This will produce:
48
+
49
+ ```go
50
+ interface {
51
+ MyOtherInterface
52
+ func MyFunc(param Param) int
53
+ }
54
+ ```
@@ -0,0 +1,29 @@
1
+ # InterfaceEmbed
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { InterfaceEmbed } from "@alloy-js/go";
7
+
8
+
9
+ <InterfaceEmbed doc={Children} refkey={Refkey}>
10
+ {children}
11
+ </InterfaceEmbed>
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { InterfaceEmbed } from "@alloy-js/go/stc";
18
+
19
+
20
+ InterfaceEmbed({ doc: Children, refkey: Refkey }).children(children)
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | | | |
26
+ | -------- | -------------------------------------------------- | ----------- |
27
+ | children | optional [Children](../../../core/types/children/) | |
28
+ | doc | optional [Children](../../../core/types/children/) | Doc comment |
29
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
@@ -0,0 +1,41 @@
1
+ # InterfaceFunction
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { InterfaceFunction } from "@alloy-js/go";
7
+
8
+
9
+ <InterfaceFunction
10
+ doc={Children}
11
+ name={string | Namekey}
12
+ parameters={FunctionParameterProps[]}
13
+ refkey={Refkey}
14
+ returns={Children}
15
+ />
16
+ ```
17
+
18
+ * stc
19
+
20
+ ```ts
21
+ import { InterfaceFunction } from "@alloy-js/go/stc";
22
+
23
+
24
+ InterfaceFunction({
25
+ doc: Children,
26
+ name: string | Namekey,
27
+ parameters: FunctionParameterProps[],
28
+ refkey: Refkey,
29
+ returns: Children,
30
+ }).children(children)
31
+ ```
32
+
33
+ ## Props
34
+
35
+ | | | |
36
+ | ---------- | ----------------------------------------------------------- | ----------- |
37
+ | doc | optional [Children](../../../core/types/children/) | Doc comment |
38
+ | name | string \| [Namekey](../../../core/types/namekey/) | |
39
+ | parameters | optional [FunctionParameterProps](../functionparameter/)\[] | |
40
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
41
+ | returns | optional [Children](../../../core/types/children/) | |
@@ -0,0 +1,56 @@
1
+ # InterfaceTypeDeclaration
2
+
3
+ Wrapper for creating a named interface type declaration.
4
+
5
+ Properties for creating a named interface type declaration. This is a combination of `InterfaceDeclarationProps` and `TypeDeclarationProps`.
6
+
7
+ * jsx
8
+
9
+ ```tsx
10
+ import { InterfaceTypeDeclaration } from "@alloy-js/go";
11
+
12
+
13
+ <InterfaceTypeDeclaration
14
+ alias
15
+ doc={Children}
16
+ name={string | Namekey}
17
+ refkey={Refkey}
18
+ refkey={Refkey}
19
+ singleLine
20
+ symbol={NamedTypeSymbol}
21
+ typeParameters={TypeParameterProps[]}
22
+ />
23
+ ```
24
+
25
+ * stc
26
+
27
+ ```ts
28
+ import { InterfaceTypeDeclaration } from "@alloy-js/go/stc";
29
+
30
+
31
+ InterfaceTypeDeclaration({
32
+ alias: boolean,
33
+ doc: Children,
34
+ name: string | Namekey,
35
+ refkey: Refkey,
36
+ refkey: Refkey,
37
+ singleLine: boolean,
38
+ symbol: NamedTypeSymbol,
39
+ typeParameters: TypeParameterProps[],
40
+ }).children(children)
41
+ ```
42
+
43
+ ## Props
44
+
45
+ | | | |
46
+ | -------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47
+ | alias | optional boolean | Whether the type is an alias |
48
+ | children | optional [Children](../../../core/types/children/) | |
49
+ | children | optional [Children](../../../core/types/children/) | Type expression |
50
+ | doc | optional [Children](../../../core/types/children/) | Documentation comment |
51
+ | name | string \| [Namekey](../../../core/types/namekey/) | Type name |
52
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
53
+ | refkey | optional [Refkey](../../../core/types/refkey/) | Type refkey |
54
+ | singleLine | optional boolean | Whether to render the interface 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. |
55
+ | symbol | optional [NamedTypeSymbol](../../types/namedtypesymbol/) | Type symbol |
56
+ | typeParameters | optional [TypeParameterProps](../typeparameter/)\[] | Type parameters |
@@ -0,0 +1,29 @@
1
+ # LineComment
2
+
3
+ A Go line comment block. The children of this component are joined with two hard linebreaks. This is useful for creating line comments with multiple paragraphs.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { LineComment } from "@alloy-js/go";
9
+
10
+
11
+ <LineComment >
12
+ {children}
13
+ </LineComment>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { LineComment } from "@alloy-js/go/stc";
20
+
21
+
22
+ LineComment({ }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | -------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
@@ -0,0 +1,29 @@
1
+ # ModuleDirectory
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { ModuleDirectory } from "@alloy-js/go";
7
+
8
+
9
+ <ModuleDirectory name="string" path="string">
10
+ {children}
11
+ </ModuleDirectory>
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { ModuleDirectory } from "@alloy-js/go/stc";
18
+
19
+
20
+ ModuleDirectory({ name: string, path: string }).children(children)
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | | | |
26
+ | -------- | -------------------------------------------------- | - |
27
+ | children | optional [Children](../../../core/types/children/) | |
28
+ | name | string | |
29
+ | path | optional string | |
@@ -0,0 +1,19 @@
1
+ # Name
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { Name } from "@alloy-js/go";
7
+
8
+
9
+ <Name />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { Name } from "@alloy-js/go/stc";
16
+
17
+
18
+ Name({ }).children(children)
19
+ ```
@@ -0,0 +1,29 @@
1
+ # Pointer
2
+
3
+ A Go pointer type that wraps the given type.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { Pointer } from "@alloy-js/go";
9
+
10
+
11
+ <Pointer >
12
+ {children}
13
+ </Pointer>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { Pointer } from "@alloy-js/go/stc";
20
+
21
+
22
+ Pointer({ }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | -------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
@@ -0,0 +1,25 @@
1
+ # Reference
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { Reference } from "@alloy-js/go";
7
+
8
+
9
+ <Reference refkey={Refkey} />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { Reference } from "@alloy-js/go/stc";
16
+
17
+
18
+ Reference({ refkey: Refkey }).children(children)
19
+ ```
20
+
21
+ ## Props
22
+
23
+ | | | |
24
+ | ------ | ------------------------------------- | - |
25
+ | refkey | [Refkey](../../../core/types/refkey/) | |
@@ -0,0 +1,35 @@
1
+ # SingleImportStatement
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { SingleImportStatement } from "@alloy-js/go";
7
+
8
+
9
+ <SingleImportStatement blank dot local package={GoSymbol} path="string" />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { SingleImportStatement } from "@alloy-js/go/stc";
16
+
17
+
18
+ SingleImportStatement({
19
+ blank: boolean,
20
+ dot: boolean,
21
+ local: boolean,
22
+ package: GoSymbol,
23
+ path: string,
24
+ }).children(children)
25
+ ```
26
+
27
+ ## Props
28
+
29
+ | | | |
30
+ | ------- | ------------------------------------------ | - |
31
+ | blank | optional boolean | |
32
+ | dot | optional boolean | |
33
+ | local | optional boolean | |
34
+ | package | optional [GoSymbol](../../types/gosymbol/) | |
35
+ | path | string | |
@@ -0,0 +1,27 @@
1
+ # SourceDirectory
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { SourceDirectory } from "@alloy-js/go";
7
+
8
+
9
+ <SourceDirectory name="string" path="string" />
10
+ ```
11
+
12
+ * stc
13
+
14
+ ```ts
15
+ import { SourceDirectory } from "@alloy-js/go/stc";
16
+
17
+
18
+ SourceDirectory({ name: string, path: string }).children(children)
19
+ ```
20
+
21
+ ## Props
22
+
23
+ | | | |
24
+ | -------- | -------------------------------------------------- | - |
25
+ | children | optional [Children](../../../core/types/children/) | |
26
+ | name | optional string | |
27
+ | path | string | |
@@ -0,0 +1,44 @@
1
+ # SourceFile
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { SourceFile } from "@alloy-js/go";
7
+
8
+
9
+ <SourceFile
10
+ export={boolean | string}
11
+ header={Children}
12
+ headerComment="string"
13
+ package="string"
14
+ path="string"
15
+ >
16
+ {children}
17
+ </SourceFile>
18
+ ```
19
+
20
+ * stc
21
+
22
+ ```ts
23
+ import { SourceFile } from "@alloy-js/go/stc";
24
+
25
+
26
+ SourceFile({
27
+ export: boolean | string,
28
+ header: Children,
29
+ headerComment: string,
30
+ package: string,
31
+ path: string,
32
+ }).children(children)
33
+ ```
34
+
35
+ ## Props
36
+
37
+ | | | |
38
+ | ------------- | -------------------------------------------------- | - |
39
+ | children | optional [Children](../../../core/types/children/) | |
40
+ | export | optional boolean \| string | |
41
+ | header | optional [Children](../../../core/types/children/) | |
42
+ | headerComment | optional string | |
43
+ | package | optional string | |
44
+ | path | string | |
@@ -0,0 +1,51 @@
1
+ # StructDeclaration
2
+
3
+ Go struct declaration.
4
+
5
+ Properties for creating a struct declaration. This can be used for both named and anonymous structs. For named structs, use `StructTypeDeclarationProps` instead.
6
+
7
+ * jsx
8
+
9
+ ```tsx
10
+ import { StructDeclaration } from "@alloy-js/go";
11
+
12
+
13
+ <StructDeclaration refkey={Refkey} singleLine>
14
+ {children}
15
+ </StructDeclaration>
16
+ ```
17
+
18
+ * stc
19
+
20
+ ```ts
21
+ import { StructDeclaration } from "@alloy-js/go/stc";
22
+
23
+
24
+ StructDeclaration({ refkey: Refkey, singleLine: boolean }).children(children)
25
+ ```
26
+
27
+ ## Props
28
+
29
+ | | | |
30
+ | ---------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
31
+ | children | optional [Children](../../../core/types/children/) | |
32
+ | refkey | optional [Refkey](../../../core/types/refkey/) | |
33
+ | 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. |
34
+
35
+ ## Example
36
+
37
+ ```tsx
38
+ <StructDeclaration>
39
+ <StructEmbed pointer>{MyOtherStruct}</StructEmbed>
40
+ <StructMember exported name="MyProperty" type="int" />
41
+ </StructDeclaration>
42
+ ```
43
+
44
+ This will produce:
45
+
46
+ ```go
47
+ struct {
48
+ MyOtherStruct
49
+ MyProperty int
50
+ }
51
+ ```