Documentation
¶
Index ¶
- Constants
- Variables
- func AnalyzeConfigBind(dir string) (pkgName string, specs []cbcg.Spec, err error)
- func AnalyzeConfigBindWithOptions(dir string, options Options) (pkgName string, specs []cbcg.Spec, err error)
- func Emit(plan *PackagePlan) ([]byte, error)
- func EmitOpenAPI(pkg string, doc Document) ([]byte, error)
- func EmitOpenAPIFragment(pkg, packagePath string, doc Document) ([]byte, error)
- func Generate(dir, outDir, outName string) (string, error)
- func GenerateOpenAPI(dir, outDir, outName string) (string, error)
- func Main(set CommandSet)
- func TemplateFiles(dir string) ([]string, error)
- func TemplateFilesWithPatterns(dir, htmlPattern, sqlPattern string) ([]string, error)
- type Artifact
- type ArtifactKind
- type CallOperation
- type CallPattern
- func Call(operation CallOperation, target CallTarget, options ...CallPatternOption) CallPattern
- func ConfigBindCall(target CallTarget, options ...CallPatternOption) CallPattern
- func ConfigSubCommandCall(target CallTarget, options ...CallPatternOption) CallPattern
- func ErrorResponseCall(target CallTarget, options ...CallPatternOption) CallPattern
- func JSONDecodeCall(target CallTarget, options ...CallPatternOption) CallPattern
- func JSONEncodeCall(target CallTarget, options ...CallPatternOption) CallPattern
- func RequestBindCall(target CallTarget, options ...CallPatternOption) CallPattern
- func ResponseWriteCall(target CallTarget, options ...CallPatternOption) CallPattern
- func ResponseWriteStatusCall(target CallTarget, options ...CallPatternOption) CallPattern
- func RouteRegisterCall(target CallTarget, options ...CallPatternOption) CallPattern
- func RowsScanCall(target CallTarget, options ...CallPatternOption) CallPattern
- func StreamCreateCall(target CallTarget, options ...CallPatternOption) CallPattern
- type CallPatternOption
- type CallRegistry
- type CallTarget
- type CheckRules
- type Command
- type CommandIO
- type CommandSet
- type ConfigBindBinding
- type ConfigBindSpec
- type DefaultRule
- type DiscoverySymbol
- type Document
- type EnumRule
- type Feature
- type FieldPlan
- type FieldSource
- type GenerateRequest
- type GenerateResult
- type Generator
- func (g *Generator) Analyze(dir string) (*PackagePlan, error)
- func (g *Generator) BuildOpenAPI(dir string) (Document, error)
- func (g *Generator) Generate(dir, outDir, outName string) (string, error)
- func (g *Generator) GenerateArtifacts(ctx context.Context, request GenerateRequest) ([]Artifact, error)
- func (g *Generator) GenerateConfigBind(dir, outDir, outName string) (string, error)
- func (g *Generator) GenerateOpenAPI(dir, outDir, outName string) (string, error)
- func (g *Generator) GeneratePackage(ctx context.Context, request GenerateRequest) (GenerateResult, error)
- func (g *Generator) GenerateTemplates(dir, outDir, outName string) (string, error)
- type MethodPattern
- type Options
- type PackagePlan
- type PatternSet
- type SymbolPattern
- type TypePattern
- type TypePlan
- type TypeSource
- type Usage
- type ValueSource
Constants ¶
const ( KindRestAny = "rest_any" // map[string]any with payload:"*" KindRestRaw = "rest_raw" // map[string]json.RawMessage with payload:"*" KindStruct = "struct" KindSlice = "slice" KindMap = "map" )
Composite and special field kinds.
const ( DefaultTemplatesName = "tinybind_templates_gen.go" DefaultHTMLTemplatePattern = "*.tb.html" DefaultSQLTemplatePattern = "*.tb.sql" )
Variables ¶
var ErrFeatureDisabled = errors.New("generator: feature disabled")
ErrFeatureDisabled is returned when a disabled generator artifact is invoked directly.
var ErrNothingToGenerate = errors.New("generator: nothing to generate")
ErrNothingToGenerate reports a package with no enabled artifacts.
Functions ¶
func AnalyzeConfigBind ¶ added in v0.1.5
AnalyzeConfigBind discovers default Bind[T](prefix) registrations.
func AnalyzeConfigBindWithOptions ¶ added in v0.1.12
func AnalyzeConfigBindWithOptions(dir string, options Options) (pkgName string, specs []cbcg.Spec, err error)
AnalyzeConfigBindWithOptions discovers configured config-bind calls.
func Emit ¶
func Emit(plan *PackagePlan) ([]byte, error)
Emit generates Go source for type-specific binders, writers, and JSON codecs. The output does not import "reflect".
func EmitOpenAPI ¶
EmitOpenAPI produces Go source for a package-named fragment. Prefer EmitOpenAPIFragment when the package import path is available.
func EmitOpenAPIFragment ¶ added in v0.1.11
EmitOpenAPIFragment produces Go source embedding and registering one package-local OpenAPI fragment.
func Generate ¶
Generate analyzes dir and writes <outName> (default: tinybind_gen.go) into outDir (default: dir). Returns the absolute path of the written file.
func GenerateOpenAPI ¶
GenerateOpenAPI builds OpenAPI 3.1 from Go sources in dir and writes a generated file that embeds the document and registers it with httpbind for serving.
func TemplateFiles ¶ added in v0.1.5
TemplateFiles returns the .tb.html and .tb.sql files directly contained in dir. A generator invocation targets one Go package and therefore does not descend into child package directories.
func TemplateFilesWithPatterns ¶ added in v0.1.13
TemplateFilesWithPatterns returns files directly contained in dir whose base names match the filepath.Match patterns for HTML and SQL templates.
Types ¶
type Artifact ¶ added in v0.1.13
type Artifact struct {
// SourcePath is the real on-disk path of the owning source. It is empty for
// package-wide artifacts.
SourcePath string
Kind ArtifactKind
// OutputBase is the suggested output base name, without directory,
// extension, or generated-file suffix.
OutputBase string
PackageName string
GoSource []byte
}
Artifact is one formatted Go source unit and the source file that owns it. The caller maps OutputBase to its own generated file name; nothing is written to disk by the API that produces Artifacts.
type ArtifactKind ¶ added in v0.1.13
type ArtifactKind string
ArtifactKind classifies one generated Go source unit.
const ( ArtifactHTMLTemplate ArtifactKind = "html_template" ArtifactSQLTemplate ArtifactKind = "sql_template" ArtifactBinding ArtifactKind = "binding" ArtifactConfigBind ArtifactKind = "configbind" ArtifactOpenAPI ArtifactKind = "openapi" )
type CallOperation ¶ added in v0.1.12
type CallOperation string
CallOperation identifies the generator meaning of a configured wrapper call.
const ( OperationRequestBind CallOperation = "request_bind" OperationResponseWrite CallOperation = "response_write" OperationResponseWriteStatus CallOperation = "response_write_status" OperationStreamCreate CallOperation = "stream_create" OperationJSONDecode CallOperation = "json_decode" OperationJSONEncode CallOperation = "json_encode" OperationRowsScan CallOperation = "rows_scan" OperationConfigBind CallOperation = "config_bind" OperationConfigSubCommand CallOperation = "config_subcommand" OperationRouteRegister CallOperation = "route_register" OperationErrorResponse CallOperation = "error_response" )
type CallPattern ¶ added in v0.1.12
type CallPattern struct {
Target CallTarget
Operation CallOperation
TypeRoles map[string]TypeSource
ArgumentRoles map[string]ValueSource
}
CallPattern maps a framework call identity onto one generator operation.
func Call ¶ added in v0.1.12
func Call(operation CallOperation, target CallTarget, options ...CallPatternOption) CallPattern
Call constructs a semantic wrapper call pattern.
func ConfigBindCall ¶ added in v0.1.12
func ConfigBindCall(target CallTarget, options ...CallPatternOption) CallPattern
ConfigBindCall declares a configbind registration wrapper.
func ConfigSubCommandCall ¶ added in v0.1.12
func ConfigSubCommandCall(target CallTarget, options ...CallPatternOption) CallPattern
ConfigSubCommandCall declares a configbind subcommand registration wrapper.
func ErrorResponseCall ¶ added in v0.1.12
func ErrorResponseCall(target CallTarget, options ...CallPatternOption) CallPattern
ErrorResponseCall declares an error constructor with a fixed HTTP status.
func JSONDecodeCall ¶ added in v0.1.12
func JSONDecodeCall(target CallTarget, options ...CallPatternOption) CallPattern
JSONDecodeCall declares a standalone JSON decoder wrapper.
func JSONEncodeCall ¶ added in v0.1.12
func JSONEncodeCall(target CallTarget, options ...CallPatternOption) CallPattern
JSONEncodeCall declares a standalone JSON encoder wrapper.
func RequestBindCall ¶ added in v0.1.12
func RequestBindCall(target CallTarget, options ...CallPatternOption) CallPattern
RequestBindCall declares a request-model binding wrapper.
func ResponseWriteCall ¶ added in v0.1.12
func ResponseWriteCall(target CallTarget, options ...CallPatternOption) CallPattern
ResponseWriteCall declares a default-status response writer wrapper.
func ResponseWriteStatusCall ¶ added in v0.1.12
func ResponseWriteStatusCall(target CallTarget, options ...CallPatternOption) CallPattern
ResponseWriteStatusCall declares a response writer wrapper with a status role.
func RouteRegisterCall ¶ added in v0.1.12
func RouteRegisterCall(target CallTarget, options ...CallPatternOption) CallPattern
RouteRegisterCall declares an HTTP route registration wrapper.
func RowsScanCall ¶ added in v0.1.12
func RowsScanCall(target CallTarget, options ...CallPatternOption) CallPattern
RowsScanCall declares a SQL row scanner wrapper.
func StreamCreateCall ¶ added in v0.1.12
func StreamCreateCall(target CallTarget, options ...CallPatternOption) CallPattern
StreamCreateCall declares a streaming response constructor wrapper.
type CallPatternOption ¶ added in v0.1.12
type CallPatternOption func(*CallPattern)
CallPatternOption adds one semantic role source to a CallPattern.
func Argument ¶ added in v0.1.12
func Argument(role string, index int) CallPatternOption
Argument reads a value role from a zero-based value argument index.
func ArgumentType ¶ added in v0.1.12
func ArgumentType(role string, index int) CallPatternOption
ArgumentType reads a type role from a zero-based value argument index.
func Constant ¶ added in v0.1.12
func Constant(role string, value any) CallPatternOption
Constant provides a fixed semantic value hidden by a wrapper.
func GenericType ¶ added in v0.1.12
func GenericType(role string, index int) CallPatternOption
GenericType reads a type role from a zero-based generic argument index.
type CallRegistry ¶ added in v0.1.12
type CallRegistry struct {
// contains filtered or unexported fields
}
CallRegistry accumulates framework wrapper declarations without global state.
func NewCallRegistry ¶ added in v0.1.12
func NewCallRegistry() *CallRegistry
NewCallRegistry creates an empty framework-local call registry.
func (*CallRegistry) Options ¶ added in v0.1.12
func (registry *CallRegistry) Options(base Options) (Options, error)
Options returns an immutable options snapshot containing defaults and wrappers.
func (*CallRegistry) Register ¶ added in v0.1.12
func (registry *CallRegistry) Register(patterns ...CallPattern) error
Register validates and adds call patterns.
type CallTarget ¶ added in v0.1.12
type CallTarget struct {
Function *SymbolPattern
Method *MethodPattern
}
CallTarget identifies either a package function or a named-receiver method.
func Function ¶ added in v0.1.12
func Function(packagePath, name string) CallTarget
Function identifies a package function used as a generator call target.
func Method ¶ added in v0.1.12
func Method(packagePath, name, receiverPackagePath, receiverType string) CallTarget
Method identifies a method used as a generator call target.
type CheckRules ¶
type CheckRules struct {
Required bool
Min *float64
Max *float64
MinLen *int
MaxLen *int
Len *int
Pattern string
Email bool
UUID bool
Date bool
Time bool
DateTime bool
}
CheckRules is the structured form of a field's check tag (codegen only).
func ParseCheckTag ¶
func ParseCheckTag(raw, kind string) (CheckRules, error)
ParseCheckTag parses a check tag value for a field of the given Go kind. Invalid syntax, unknown rules, type mismatches, and invalid patterns fail here.
func (CheckRules) HasValidation ¶ added in v0.1.6
func (c CheckRules) HasValidation() bool
HasValidation reports whether the check rules can reject a bound value. Every check rule can; defaults live in DefaultRule precisely because they cannot. Enums can too, but are their own tag: see FieldPlan.HasValidation.
type Command ¶ added in v0.1.12
type Command struct {
Name string
Summary string
Run func(context.Context, []string, CommandIO) int
}
Command is one independently testable subcommand.
func GenerateCommand ¶ added in v0.1.12
GenerateCommand creates the tinybind generate subcommand.
type CommandIO ¶ added in v0.1.12
type CommandIO struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
WorkingDirectory string
Environment []string
}
CommandIO contains process state injected into a command execution.
type CommandSet ¶ added in v0.1.12
type CommandSet struct {
// contains filtered or unexported fields
}
CommandSet is an immutable command dispatcher.
func MustCommandSet ¶ added in v0.1.12
func MustCommandSet(commands ...Command) CommandSet
MustCommandSet is NewCommandSet for process setup code and panics on invalid commands.
func NewCommandSet ¶ added in v0.1.12
func NewCommandSet(commands ...Command) (CommandSet, error)
NewCommandSet validates commands and constructs an immutable dispatcher.
type ConfigBindBinding ¶ added in v0.1.5
type ConfigBindBinding struct {
TypeName string
Prefix string
SubCommand bool
Name string
Help string
// SourcePath is the Go file containing the discovered call.
SourcePath string
}
ConfigBindBinding is one discovered configbind.Bind[T](prefix) call.
type ConfigBindSpec ¶ added in v0.1.13
ConfigBindSpec pairs one generated config definition with the source file whose call declared it.
func AnalyzeConfigBindSources ¶ added in v0.1.13
func AnalyzeConfigBindSources(dir string, options Options) (pkgName string, specs []ConfigBindSpec, err error)
AnalyzeConfigBindSources is AnalyzeConfigBindWithOptions with the owning source file retained for every discovered definition.
type DefaultRule ¶ added in v0.2.0
DefaultRule is the parsed default tag of a field (codegen only). A default is not a constraint: it never rejects a value, it only fills in one that never arrived, which is why it lives outside the check tag.
func ParseDefaultTag ¶ added in v0.2.0
func ParseDefaultTag(raw, kind string) (DefaultRule, error)
ParseDefaultTag parses a default tag value for a field of the given Go kind. Callers pass only tags that are actually present, so default:"" stays distinguishable from a missing tag. Unsupported kinds and values that cannot be converted to the field type fail here.
type DiscoverySymbol ¶
type DiscoverySymbol struct {
PackagePath string
Name string
ReceiverPackagePath string
ReceiverType string
Usage Usage
TypeArgument int
ArgumentType *int
}
DiscoverySymbol identifies a generic function and the entry point it needs. PackagePath is matched by go/types identity, so import aliases are supported.
type Document ¶
Document is an OpenAPI 3.1 document represented as ordered JSON-friendly maps. Keys under paths/operations/components are sorted for deterministic output.
func BuildOpenAPI ¶
BuildOpenAPI analyzes dir with the route parser and field planner and returns an OpenAPI 3.1 document derived only from Go source (not from handwritten YAML).
func (Document) MarshalJSON ¶
MarshalJSON returns deterministic indented OpenAPI JSON.
type EnumRule ¶ added in v0.2.0
EnumRule is the parsed enum tag of a field (codegen only). Unlike a default, an enum can reject a value, so it counts as validation; it lives outside the check tag only because config structs already spell it this way.
func ParseEnumTag ¶ added in v0.2.0
ParseEnumTag parses an enum tag value for a field of the given Go kind. Values are comma-separated, which means a value cannot contain a comma — the same limit the check tag had, where commas separated rules.
type Feature ¶
type Feature string
Feature identifies a generator capability that can be permanently disabled.
const ( FeatureRouteDiscovery Feature = "route-discovery" FeatureOpenAPI Feature = "openapi" FeatureBind Feature = "bind" FeatureWrite Feature = "write" FeatureWriteStatus Feature = "write-status" FeatureDecodeJSON Feature = "decode-json" FeatureEncodeJSON Feature = "encode-json" FeatureStreaming Feature = "streaming" FeatureScanRows Feature = "scan-rows" FeatureMultipartFile Feature = "multipart-file" // FeatureHelpBackfill writes help tags derived from godoc into config // structs. Disable it to keep hand-written sources untouched. FeatureHelpBackfill Feature = "help-backfill" )
type FieldPlan ¶
type FieldPlan struct {
Name string // Go field name
Wire string // wire / tag name ("*" for payload rest)
Source FieldSource // input|query|payload|path|header|cookie|method
Kind string // string|int|int64|bool|float64|file|rest_*|struct|slice|map
JSON string // json name for encode/document keys
Check CheckRules // from check:"" tag; empty if absent
Enum EnumRule // from enum:"" tag; unset if absent
Default DefaultRule // from default:"" tag; unset if absent
TypeName string // KindStruct name, or element struct name for slice/map of struct
ElemKind string // for slice/map: string|int|int64|bool|float64|struct
DB string // SQL result column (db tag or snake_case field name)
GroupKey bool // groupkey tag presence
Doc string // godoc of the field (doc or line comment)
}
FieldPlan is one struct field mapping plan (compile-time).
func (FieldPlan) GoType ¶
GoType returns a Go type string for generated code (e.g. NestedCustomer, []string).
func (FieldPlan) HasValidation ¶ added in v0.2.0
HasValidation reports whether anything about the field can reject a bound value, across every tag that carries a constraint.
func (FieldPlan) IsComposite ¶
IsComposite reports nested struct/slice/map kinds.
func (FieldPlan) NeedsPresence ¶ added in v0.2.0
NeedsPresence is true when codegen must track whether the field was present: validation has to skip absent optional values, and a default only applies to a field nobody supplied.
type FieldSource ¶
type FieldSource string
FieldSource is where a request field is read from.
const ( SourceInput FieldSource = "input" SourceQuery FieldSource = "query" SourcePayload FieldSource = "payload" SourcePath FieldSource = "path" SourceHeader FieldSource = "header" SourceCookie FieldSource = "cookie" SourceMethod FieldSource = "method" )
type GenerateRequest ¶ added in v0.1.12
type GenerateRequest struct {
Dir string
Out string
Name string
OpenAPI bool
OpenAPIName string
TemplatesName string
// HTMLTemplatePattern and SQLTemplatePattern override template discovery
// globs. Empty values retain the generator options.
HTMLTemplatePattern string
SQLTemplatePattern string
// SQLDialect overrides the generator option for this run. An empty value
// retains it.
SQLDialect string
ConfigBindName string
Check bool
GenerateAll bool
// Force regenerates even when the generated files record the current input
// hash. Use it after a change the hash does not cover, such as an edit in
// another package of the module.
Force bool
SQLContextAPI bool
// SQLContextOnlyAPI enables the context-only SQL API for this run. It can
// turn the option on, never off.
SQLContextOnlyAPI bool
}
GenerateRequest configures one package-local generation execution.
type GenerateResult ¶ added in v0.1.12
type GenerateResult struct {
BinderPath string
ConfigBindPath string
OpenAPIPath string
TemplatesPath string
Diagnostics []parser.Diagnostic
// Cached reports that the paths were left untouched because the generated
// files already record the current input hash.
Cached bool
}
GenerateResult records generated artifacts or check diagnostics.
func (GenerateResult) Paths ¶ added in v0.1.12
func (result GenerateResult) Paths() []string
Paths returns non-empty artifact paths in generation order.
type Generator ¶
type Generator struct{ Options Options }
Generator is a reusable, configurable code generator.
func (*Generator) Analyze ¶
func (g *Generator) Analyze(dir string) (*PackagePlan, error)
Analyze analyzes a package using this generator's discovery symbols.
func (*Generator) BuildOpenAPI ¶
BuildOpenAPI builds a document using this generator's discovery identities.
func (*Generator) GenerateArtifacts ¶ added in v0.1.13
func (g *Generator) GenerateArtifacts(ctx context.Context, request GenerateRequest) ([]Artifact, error)
GenerateArtifacts runs every enabled generation phase and returns the result as per-source artifacts. It writes no file, so the same call serves both generation and --check.
func (*Generator) GenerateConfigBind ¶ added in v0.1.5
GenerateConfigBind analyzes dir for configbind.Bind usage and writes configbind_gen.go. Returns the absolute path written, or "" if no Bind calls found.
func (*Generator) GenerateOpenAPI ¶
GenerateOpenAPI writes OpenAPI generated with this generator's identities.
func (*Generator) GeneratePackage ¶ added in v0.1.12
func (g *Generator) GeneratePackage(ctx context.Context, request GenerateRequest) (GenerateResult, error)
GeneratePackage executes every enabled generator phase without CLI or process ownership.
func (*Generator) GenerateTemplates ¶ added in v0.1.5
GenerateTemplates discovers files using the configured template patterns and writes one Go file containing all generated declarations. It returns an empty path when no templates exist.
type MethodPattern ¶
type MethodPattern struct {
PackagePath string
Name string
ReceiverPackagePath string
ReceiverType string
}
MethodPattern identifies a method and its receiver type.
type Options ¶
type Options struct {
ServeMuxes PatternSet[TypePattern]
RouteMethods PatternSet[MethodPattern]
RouteFunctions PatternSet[SymbolPattern]
RuntimePackages PatternSet[string]
Calls PatternSet[CallPattern]
FileTypes PatternSet[TypePattern]
// HTMLTemplatePattern and SQLTemplatePattern are filepath.Match patterns
// applied to file base names. Empty values use the standard patterns.
HTMLTemplatePattern string
SQLTemplatePattern string
// SQLDialect names the target database for SQL templates: "postgresql",
// "mysql", or "sqlite". A run that discovers a SQL template must set it.
// There is no default, because an assumed dialect emits placeholders the
// target engine rejects, and nothing about the templates reveals the
// mistake.
SQLDialect string
// SQLContextAPI adds Context-resolved wrappers for exported SQL templates.
SQLContextAPI bool
// SQLContextOnlyAPI publishes only the Context-resolved SQL surface under
// the name declared in the template. The executor-taking function becomes
// unexported and no <Component>Context wrapper is generated. It implies
// SQLContextAPI.
SQLContextOnlyAPI bool
// SQLExecutorResolver selects a framework-specific Context resolver and
// implies SQLContextAPI. Nil uses sqlbind.SQLExecutorFromContext.
SQLExecutorResolver *SymbolPattern
// PreserveTemplateWhitespace keeps the authoring indentation and newlines of
// HTML templates in generated static output instead of collapsing each run
// to one space. The default collapses, which renders identically and drops
// every indentation byte from the generated source and the binary.
PreserveTemplateWhitespace bool
DisableFeatures []Feature
GenerateAll bool
}
Options configures discovery identities and generated template APIs. A zero Options value intentionally discovers nothing and disables optional wrappers; use DefaultOptions for standard behavior.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns the standard tinybind runtime setup.
type PackagePlan ¶
type PackagePlan struct {
Package string
PackagePath string
Types []TypePlan
// Discovered lists type names referenced by configured generic call sites.
Discovered []string
}
PackagePlan is all type plans in a package.
func AnalyzePackage ¶
func AnalyzePackage(dir string) (*PackagePlan, error)
AnalyzePackage builds field plans for all package-level structs with exported fields. Generic call discovery (Bind/Write/DecodeJSON/EncodeJSON) uses go/types symbol identity.
func AnalyzePackageWithOptions ¶
func AnalyzePackageWithOptions(dir string, opts Options) (*PackagePlan, error)
AnalyzePackageWithOptions is AnalyzePackage with customizable call targets.
type PatternSet ¶
PatternSet is an authoritative set of discovery identities. Set replaces, rather than extends, any defaults. Disabled suppresses the feature entirely.
type SymbolPattern ¶
type SymbolPattern struct{ PackagePath, Name string }
SymbolPattern identifies a package-level declaration by go/types identity.
type TypePattern ¶
type TypePattern struct{ PackagePath, Name string }
TypePattern identifies a named type by go/types identity.
type TypePlan ¶
type TypePlan struct {
Name string
// SourcePath is the Go file that declares the type. It is the owning source
// of every artifact generated for this type.
SourcePath string
Fields []FieldPlan
// Doc is the godoc of the type declaration.
Doc string
// Usage records which generated entry points are referenced by source code.
// Zero means the type is unused and emits no mapping paths.
Usage Usage
// DirectUsage excludes usage inherited from containing structs.
DirectUsage Usage
}
TypePlan is the mapping plan for one struct type.
type TypeSource ¶ added in v0.1.12
TypeSource selects a semantic type from a generic argument or value argument.
type Usage ¶
type Usage uint32
Usage selects generated mapping entry points.
const ( UsageBind Usage = 1 << iota UsageWrite UsageDecodeJSON UsageEncodeJSON UsageScanRows UsageAll = UsageBind | UsageWrite | UsageDecodeJSON | UsageEncodeJSON )
type ValueSource ¶ added in v0.1.12
ValueSource selects a semantic value from a value argument or a fixed constant.