Documentation
¶
Overview ¶
Package pipeline orchestrates the entire code generation process.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiagnosticsError ¶
type DiagnosticsError struct {
Diagnostic queryanalyzer.Diagnostic
Cause error
}
DiagnosticsError indicates that errors were reported via diagnostics.
func (*DiagnosticsError) Error ¶
func (e *DiagnosticsError) Error() string
func (*DiagnosticsError) Unwrap ¶
func (e *DiagnosticsError) Unwrap() error
type Environment ¶
type Environment struct {
FSResolver func(string) (fileset.Resolver, error)
Logger logging.Logger
Writer Writer
SchemaParser schemaparser.SchemaParser // injectable schema parser (deprecated: use Engine)
Generator codegen.Generator // injectable generator
Cache cache.Cache // injectable cache
Engine engine.Engine // injectable database engine
Verifier verify.Verifier // optional; nil => pure static analysis
VerifiedCache *verify.Cache // committed verified types loaded by the CLI; nil = none
}
Environment captures external dependencies used by the pipeline.
type Hooks ¶
type Hooks struct {
// BeforeParse is called before parsing schema files.
// Return an error to abort the pipeline.
BeforeParse func(ctx context.Context, schemaPaths []string) error
// AfterParse is called after all schemas are parsed.
// Return an error to abort the pipeline.
AfterParse func(ctx context.Context, catalog *model.Catalog) error
// BeforeAnalyze is called before analyzing queries.
// Return an error to abort the pipeline.
BeforeAnalyze func(ctx context.Context, queryPaths []string) error
// AfterAnalyze is called after all queries are analyzed.
// Return an error to abort the pipeline.
AfterAnalyze func(ctx context.Context, analyses []analyzer.Result) error
// BeforeGenerate is called before generating code.
// Return an error to abort the pipeline.
BeforeGenerate func(ctx context.Context, analyses []analyzer.Result) error
// AfterGenerate is called after code is generated.
// Return an error to abort the pipeline.
AfterGenerate func(ctx context.Context, files []codegen.File) error
// BeforeWrite is called before writing files.
// Return an error to abort the pipeline.
BeforeWrite func(ctx context.Context, files []codegen.File) error
// AfterWrite is called after all files are written.
// This is the final hook, called even if earlier stages failed.
AfterWrite func(ctx context.Context, summary Summary) error
}
Hooks provides extension points in the pipeline execution. Each hook is called at a specific stage and can modify behavior or perform side effects.
type MemoryWriter ¶
MemoryWriter implements Writer for testing without filesystem I/O.
func (*MemoryWriter) FileCount ¶
func (m *MemoryWriter) FileCount() int
FileCount returns the number of files.
func (*MemoryWriter) GetFile ¶
func (m *MemoryWriter) GetFile(path string) ([]byte, bool)
GetFile retrieves a file's content.
func (*MemoryWriter) HasFile ¶
func (m *MemoryWriter) HasFile(path string) bool
HasFile checks if a file exists.
type Pipeline ¶
type Pipeline struct {
Env Environment
Hooks Hooks // extension hooks
}
Pipeline orchestrates configuration loading, analysis, and code generation.
type RunOptions ¶
type RunOptions struct {
ConfigPath string
OutOverride string
DryRun bool
ListQueries bool
StrictConfig bool
NoJSONTags bool
EmitPointersForNull bool
SQLDialect string
EmitIFNotExists bool
// SkipVerifiedCache suppresses the applyVerifiedCache branch even when
// [verify] is enabled. Used by the 'verify' subcommand's internal dry-run
// so it does not emit a spurious "no verified cache" warning/error.
SkipVerifiedCache bool
}
RunOptions configures a pipeline execution.
type Summary ¶
type Summary struct {
Files []codegen.File
Diagnostics []queryanalyzer.Diagnostic
Analyses []queryanalyzer.Result
Catalog *model.Catalog
}
Summary captures generated files and diagnostics collected during a run.
type WriteError ¶
WriteError wraps failures encountered while writing generated files.
func (*WriteError) Error ¶
func (e *WriteError) Error() string
func (*WriteError) Unwrap ¶
func (e *WriteError) Unwrap() error