Documentation
¶
Overview ¶
Package provider implements input providers for extracting type information from Go code. Providers convert Go types into the intermediate representation (IR) that generators use to produce target language code.
Package provider implements input providers that extract type information from Go code and convert it to the intermediate representation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReflectionInputOptions ¶
type ReflectionInputOptions struct {
// RootTypes are the types to extract, specified as reflect.Type values.
RootTypes []reflect.Type
}
ReflectionInputOptions configures reflection-based type extraction.
type ReflectionProvider ¶
type ReflectionProvider struct{}
ReflectionProvider extracts types using runtime reflection. This secondary provider exists primarily to validate that the IR abstraction is not overly coupled to go/types internals. Production use cases SHOULD prefer the Source Provider for its richer feature set.
func (*ReflectionProvider) BuildSchema ¶
func (p *ReflectionProvider) BuildSchema(ctx context.Context, opts ReflectionInputOptions) (*ir.Schema, error)
BuildSchema extracts types and returns a Schema.
type RootType ¶
type RootType struct {
// Name is the type name (e.g., "User", "Page").
// For generic instantiations, this should be the base name without type parameters.
Name string
// Package is the full package path (e.g., "github.com/foo/api").
Package string
}
RootType identifies a type to extract with its package context.
type SourceInputOptions ¶
type SourceInputOptions struct {
// Packages are the Go package paths to analyze.
Packages []string
// RootTypes are the types to extract with package context.
// If empty, all exported types in the packages are extracted.
RootTypes []RootType
}
SourceInputOptions configures source-based type extraction.
type SourceProvider ¶
type SourceProvider struct{}
SourceProvider extracts types by analyzing Go source code.
func (*SourceProvider) BuildSchema ¶
func (p *SourceProvider) BuildSchema(ctx context.Context, opts SourceInputOptions) (*ir.Schema, error)
BuildSchema analyzes source code and returns a Schema. The provider recursively extracts all types reachable from RootTypes.