package generator
import "go.trulyao.dev/robin/generator"
Index ¶
- func New(procedures []types.Procedure) *generator
- func NormalizeProcedureName(name string) string
- type GenerateBindingsOpts
- type GenerateMethodsOpts
- type GeneratedMethods
- type MethodTemplateOpts
- type TemplateOpts
Functions ¶
func New ¶
func NormalizeProcedureName ¶
NormalizeProcedureName normalizes the procedure name to a valid typescript function name For example, todo.create -> todoCreate, sign-in -> signIn etc This is done to ensure that the generated method names are valid
Types ¶
type GenerateBindingsOpts ¶
type GenerateBindingsOpts struct {
// Whether to include the schema in the generated bindings file or not
IncludeSchema bool
// The generated schema type
Schema string
// Whether to use the union result type or not - when enabled, the result type will be a uniion of the Ok and Error types which would disallow access to any of the fields without checking the `ok` field first
UseUnionResult bool
// Whether to throw a ProcedureCallError when a procedure call fails for any reason (e.g. invalid payload, user-defined error, etc.) instead of returning an error result
ThrowOnError bool
}
type GenerateMethodsOpts ¶
type GenerateMethodsOpts struct {
ThrowOnError bool
}
type GeneratedMethods ¶
type MethodTemplateOpts ¶
type MethodTemplateOpts struct {
OriginalName string
Name string
Type string
HasPayload bool
ThrowOnError bool
}
type TemplateOpts ¶
type TemplateOpts struct {
// Whether to include the schema in the generated bindings file or not
IncludeSchema bool
// The generated schema type
Schema string
// The generated query methods
QueryMethods string
// The generated mutation methods
MutationMethods string
// Whether to use the union result type or not - when enabled, the result type will be a uniion of the Ok and Error types which would disallow access to any of the fields without checking the `ok` field first
UseUnionResult bool
// Whether to throw a ProcedureCallError when a procedure call fails for any reason (e.g. invalid payload, user-defined error, etc.) instead of returning an error result
ThrowOnError bool
}
Source Files ¶
generator.go
Directories ¶
| Path | Synopsis |
|---|---|
| generator/templates |
- Version
- v0.8.2 (latest)
- Published
- Apr 4, 2025
- Platform
- linux/amd64
- Imports
- 14 packages
- Last checked
- 6 months ago –
Tools for package owners.