@alloy-js/go 0.3.0-dev.3 → 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.
- package/CHANGELOG.md +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/FunctionDeclaration.md +53 -0
- package/docs/api/components/FunctionParameter.md +40 -0
- package/docs/api/components/FunctionParameters.md +29 -0
- package/docs/api/components/FunctionReceiver.md +38 -0
- package/docs/api/components/ImportStatements.md +25 -0
- package/docs/api/components/InterfaceDeclaration.md +54 -0
- package/docs/api/components/InterfaceEmbed.md +29 -0
- package/docs/api/components/InterfaceFunction.md +41 -0
- package/docs/api/components/InterfaceTypeDeclaration.md +56 -0
- package/docs/api/components/LineComment.md +29 -0
- package/docs/api/components/ModuleDirectory.md +29 -0
- package/docs/api/components/Name.md +19 -0
- package/docs/api/components/Pointer.md +29 -0
- package/docs/api/components/Reference.md +25 -0
- package/docs/api/components/SingleImportStatement.md +35 -0
- package/docs/api/components/SourceDirectory.md +27 -0
- package/docs/api/components/SourceFile.md +44 -0
- package/docs/api/components/StructDeclaration.md +51 -0
- package/docs/api/components/StructEmbed.md +29 -0
- package/docs/api/components/StructMember.md +41 -0
- package/docs/api/components/StructTypeDeclaration.md +56 -0
- package/docs/api/components/TypeConstraint.md +28 -0
- package/docs/api/components/TypeDeclaration.md +47 -0
- package/docs/api/components/TypeDeclarationGroup.md +27 -0
- package/docs/api/components/TypeParameter.md +37 -0
- package/docs/api/components/TypeParameters.md +25 -0
- package/docs/api/components/VariableDeclaration.md +44 -0
- package/docs/api/components/VariableDeclarationGroup.md +28 -0
- package/docs/api/components/index.md +30 -0
- package/docs/api/contexts/TypeDeclarationGroup-context.md +17 -0
- package/docs/api/contexts/VariableDeclarationGroup-context.md +18 -0
- package/docs/api/contexts/index.md +4 -0
- package/docs/api/functions/createAnonymousTypeSymbol.md +25 -0
- package/docs/api/functions/createFunctionScope.md +26 -0
- package/docs/api/functions/createFunctionSymbol.md +35 -0
- package/docs/api/functions/createGoModuleScope.md +18 -0
- package/docs/api/functions/createGoNamePolicy.md +17 -0
- package/docs/api/functions/createGoPackageScope.md +18 -0
- package/docs/api/functions/createInterfaceMemberSymbol.md +25 -0
- package/docs/api/functions/createModule.md +20 -0
- package/docs/api/functions/createNamedTypeScope.md +27 -0
- package/docs/api/functions/createNestedStructSymbol.md +26 -0
- package/docs/api/functions/createPackageSymbol.md +19 -0
- package/docs/api/functions/createParameterSymbol.md +36 -0
- package/docs/api/functions/createPropertySymbol.md +34 -0
- package/docs/api/functions/createStructMemberSymbol.md +25 -0
- package/docs/api/functions/createTypeParameterSymbol.md +25 -0
- package/docs/api/functions/createTypeSymbol.md +26 -0
- package/docs/api/functions/createVariableSymbol.md +34 -0
- package/docs/api/functions/index.md +29 -0
- package/docs/api/functions/ref.md +18 -0
- package/docs/api/functions/useEnclosingPackageScope.md +17 -0
- package/docs/api/functions/useFuncScope.md +17 -0
- package/docs/api/functions/useGoNamePolicy.md +17 -0
- package/docs/api/functions/useGoScope.md +17 -0
- package/docs/api/functions/useLexicalScope.md +17 -0
- package/docs/api/functions/useModule.md +17 -0
- package/docs/api/functions/useNamedTypeScope.md +17 -0
- package/docs/api/functions/usePackage.md +17 -0
- package/docs/api/functions/useSourceFileScope.md +17 -0
- package/docs/api/index.md +7 -0
- package/docs/api/types/CreateTypeParameterSymbolOptions.md +9 -0
- package/docs/api/types/Descriptor.md +5 -0
- package/docs/api/types/EmbedDescriptor.md +9 -0
- package/docs/api/types/FieldDescriptor.md +9 -0
- package/docs/api/types/FunctionDescriptor.md +9 -0
- package/docs/api/types/FunctionSymbol.md +13 -0
- package/docs/api/types/GoElements.md +5 -0
- package/docs/api/types/GoFunctionScope.md +12 -0
- package/docs/api/types/GoLexicalScope.md +11 -0
- package/docs/api/types/GoModuleScope.md +10 -0
- package/docs/api/types/GoNamedTypeScope.md +16 -0
- package/docs/api/types/GoPackageScope.md +10 -0
- package/docs/api/types/GoScope.md +10 -0
- package/docs/api/types/GoSourceFileScope.md +13 -0
- package/docs/api/types/GoSymbol.md +17 -0
- package/docs/api/types/GoSymbolKinds.md +5 -0
- package/docs/api/types/GoSymbolOptions.md +10 -0
- package/docs/api/types/ImportRecords.md +5 -0
- package/docs/api/types/InterfaceDescriptor.md +9 -0
- package/docs/api/types/LibraryFrom.md +5 -0
- package/docs/api/types/MemberDescriptor.md +8 -0
- package/docs/api/types/MethodDescriptor.md +9 -0
- package/docs/api/types/NamedTypeDescriptor.md +8 -0
- package/docs/api/types/NamedTypeSymbol.md +17 -0
- package/docs/api/types/NamedTypeSymbolKind.md +5 -0
- package/docs/api/types/NamedTypeSymbolOptions.md +9 -0
- package/docs/api/types/NamedTypeTypeKind.md +5 -0
- package/docs/api/types/PackageDescriptor.md +12 -0
- package/docs/api/types/PackageSymbol.md +15 -0
- package/docs/api/types/PackageSymbolOptions.md +10 -0
- package/docs/api/types/ResolveDescriptor.md +7 -0
- package/docs/api/types/SourceFileHeaderProps.md +9 -0
- package/docs/api/types/StrictDescriptor.md +5 -0
- package/docs/api/types/StructDescriptor.md +9 -0
- package/docs/api/types/TypeDescriptor.md +9 -0
- package/docs/api/types/VariableDescriptor.md +9 -0
- package/docs/api/types/index.md +38 -0
- package/docs/api/variables/index.md +3 -0
- package/docs/api/variables/std.md +2463 -0
- package/package.json +6 -6
|
@@ -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,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
|
+
```
|