{"modulePath":"github.com/viant/datly","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package compiler\n\nPackage compiler converts canonical view metadata and typed contracts into immutable SQL reader plans. Each graph starts with a detached spec.View snapshot owned by data.View.Spec. Enrichment updates that snapshot; only resolved SQL columns and paired field links need reader projections. Publication ends enrichment. Collector state, native caches, partitioners, templates and execution remain with their existing reader owners. This package does not parse authored DQL, register runtime components, scan rows, or execute SQL.\n\n## Variables\n\n```go\nvar (\n\tViewSlot    = OutputSlot{OutputName: \"view\", FieldName: \"Data\"}\n\tStatusSlot  = OutputSlot{OutputName: \"status\", FieldName: \"Status\"}\n\tMetricsSlot = OutputSlot{OutputName: \"metrics\", FieldName: \"Metrics\"}\n)\n```\n\n## Functions\n\n```go\nfunc Compile(input Input) (*sqlreader.Plan, error)\n```\n\n```go\nfunc CompileSelectorBindings(component *spec.Component, inputType reflect.Type, root *data.View, bindings []bindly.BindingSpec) ([]sqlreader.SelectorBindingPlan, error)\n```\n\n```go\nfunc CompileViewDependencies(input Input) ([]*sqlreader.ViewDependency, error)\n```\nCompileViewDependencies compiles independent canonical views referenced by Bindly input bindings into the same reader plans used by route reads.\n\n```go\nfunc CompileViewMetadata(input Input) (*data.View, error)\n```\nCompileViewMetadata resolves the same output graph as a reader without compiling SQL programs, collectors, codecs, or an executable reader plan.\n\n```go\nfunc ResolveOutputField(component *spec.Component, outputType reflect.Type, slot OutputSlot) string\n```\nResolveOutputField resolves the exported output-struct field backing a reserved output slot. It first honors an explicit output-kind param whose Source.Name matches the slot output name (view also accepts body), then uses the slot's conventional field when no param claims it.\n\n## Types\n\n```go\ntype Input struct {\n\tConst           *constant.Values\n\tCodecFactory    xcodec.Factory\n\tComponent       *spec.Component\n\tInputType       reflect.Type\n\tOutputType      reflect.Type\n\tBindings        []bindly.BindingSpec\n\tPredicate       dexec.PredicateEvaluator\n\tTypeLookup      func(name string) (reflect.Type, error)\n\tDirectViewField string\n\tDirectViewType  reflect.Type\n\tResources       fs.FS\n}\n```\n\n```go\ntype OutputSlot struct {\n\tOutputName string\n\tFieldName  string\n}\n```\nOutputSlot describes one reserved output slot: the logical output name used by \\`output/...\\` params and the conventional exported field name used when no param claims the slot explicitly.\n\n","path":"github.com/viant/datly/sql/reader/compiler","name":"compiler","synopsis":"Package compiler converts canonical view metadata and typed contracts into immutable SQL reader plans.","isRedistributable":true}
