{"modulePath":"github.com/viant/datly","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package exec\n\nPackage exec defines narrow execution ports consumed across Datly runtime and SQL ownership boundaries.\n\n## Constants\n\n```go\nconst ComponentInvokerKey xhandler.ValueKey = \"component_invoker\"\n```\n\n```go\nconst PredicateVariable = \"predicate\"\n```\n\n```go\nconst ReaderInputPreparerKey xhandler.ValueKey = \"reader_input_preparer\"\n```\n\n## Variables\n\n```go\nvar ErrCacheViewNotFound = errors.New(\"cached view not found\")\n```\n\n## Functions\n\n```go\nfunc AllowsReportOrdering(ctx context.Context, component spec.Key, view string) bool\n```\nAllowsReportOrdering checks the exact component and canonical view. Runtime has already checked the route when entering this invocation.\n\n```go\nfunc BeginOutputSelection(ctx context.Context)\n```\nBeginOutputSelection excludes input preparation reads from output selection.\n\n```go\nfunc CaptureChildOutputSelection(ctx context.Context) context.Context\n```\nCaptureChildOutputSelection isolates one explicitly delegated output read. The caller must publish SelectedOutputFields(childContext, childResult) for its own result, and is responsible for preserving the filter's field paths. Ordinary child/input/sibling reads never inherit this publication authority.\n\n```go\nfunc CaptureOutputSelection(ctx context.Context) context.Context\n```\nCaptureOutputSelection installs a transport-owned result slot. Typed handler results remain unchanged; explicit response and custom marshal owners can ignore it.\n\n```go\nfunc EnterReportOrdering(ctx context.Context, target ComponentTarget, permission *ReportOrdering) (context.Context, error)\n```\nEnterReportOrdering replaces, rather than inherits, the parent's permission. Runtime calls it at every component boundary, including input dependencies.\n\n```go\nfunc ErrorMessage(err error, status int) string\n```\nErrorMessage projects errors without an explicit response.BodyError payload. Authored binding messages remain intentional policy, including ${error}; unclassified server failures never acquire a public diagnostic message.\n\n```go\nfunc InvocationTransaction(ctx context.Context, db *sql.DB) (*sql.Tx, error)\n```\nInvocationTransaction returns the active transaction for one exact database handle. It does not transfer commit or rollback ownership to the caller.\n\n```go\nfunc PublishOutputSelection(ctx context.Context, result any, filter OutputFieldFilter)\n```\nPublishOutputSelection records a completed typed reader result in this frame. A sealed frame ignores reads initiated by output finalizers.\n\n```go\nfunc ReportOrderingFields(ctx context.Context, component spec.Key, view string) []string\n```\nReportOrderingFields returns a detached set of selected scalar identities. Hidden relation keys do not become sortable merely by entering SQL projection.\n\n```go\nfunc ScopeOutputSelection(ctx context.Context) (context.Context, func(any, error))\n```\nScopeOutputSelection shadows parent state at every canonical component entry. Only the outer frame can publish to the transport, after its handler returns.\n\n```go\nfunc ValidateCacheScope(scope string) error\n```\n\n```go\nfunc WantsOutputSelection(ctx context.Context) bool\n```\nWantsOutputSelection lets ordinary typed reader calls avoid wire compilation.\n\n```go\nfunc WithInvocationTransactionLookup(ctx context.Context, lookup func(context.Context, *sql.DB) (*sql.Tx, error)) context.Context\n```\nWithInvocationTransactionLookup lets SQL readers find the transaction owned by the first endpoint invocation. The lookup runs when a connector resolves, after an imperative child writer may have started that transaction.\n\n## Types\n\n```go\ntype CacheInvalidation struct {\n\tView       string `json:\"view\"`\n\tScope      string `json:\"scope\"`\n\tGeneration string `json:\"generation,omitempty\"`\n\tError      string `json:\"error,omitempty\"`\n}\n```\n\n```go\ntype CacheServiceInvalidator interface {\n\tInvalidateCache(context.Context, string) (string, error)\n}\n```\nCacheServiceInvalidator lets supplied cache services support administration without importing Datly's internal generation implementation.\n\n```go\ntype ComponentInvoker interface {\n\tInvokeComponent(context.Context, ComponentRequest) (any, error)\n}\n```\n\n```go\ntype ComponentRequest struct {\n\tTarget ComponentTarget\n\tInput  any\n\t// Replay is a native binding seed, never pre-bound component input.\n\tReplay *bindly.ReplayBinding\n\t// BindingOutput supplies the calling output to explicitly declared output bindings.\n\tBindingOutput any\n\tProviders     []locator.Provider\n\t// Completion observes canonical managed-transaction evidence for this root.\n\t// It is trusted service metadata and never client-bindable.\n\tCompletion func(xhandler.Outcome)\n\t// PrepareQuery requests a bound root query through the same input lifecycle.\n\t// It is a trusted component capability, never a transport request option.\n\tPrepareQuery bool\n\t// DryRun plans an ordinary reader root without opening a row reader.\n\t// Input initialization, providers and SQL templates still run.\n\tDryRun bool\n\t// ReaderOptions apply after canonical input binding, to the target reader's\n\t// result graph. Dependency binding retains its own invocation context policy.\n\tReaderOptions *ReaderOptions\n\t// ReportOrdering is explicit report-only ordering permission. It is never\n\t// inherited by child calls and does not enable pagination or other selectors.\n\tReportOrdering *ReportOrdering\n\t// WarmupOmitInput names trusted warmup-owned inputs that are intentionally\n\t// absent from canonical transport binding, such as an indexed warmup key.\n\tWarmupOmitInput []string\n\tWarmup          *ReaderWarmupRequest\n}\n```\nComponentRequest invokes an exact target. Input is reserved for a trusted caller that already owns the canonical typed component input.\n\n```go\ntype ComponentTarget struct {\n\tComponent spec.Key\n\tRoute     spec.RouteRef\n}\n```\nComponentTarget identifies one exact component route.\n\n```go\nfunc (t ComponentTarget) String() string\n```\n\n```go\ntype ConnectorDataSourceProvider interface {\n\tConnectorDataSource(ctx context.Context, name string) (DataSource, error)\n}\n```\nConnectorDataSourceProvider supplies a lazy source for an explicitly named connector. The SQL layer owns source construction; the invocation engine owns its transaction lifecycle. Unknown names must not select a default.\n\n```go\ntype DataSource interface {\n\tOpen(ctx context.Context) (xhandler.Data, error)\n}\n```\nDataSource opens one lazy handler data capability for an invocation.\n\n```go\ntype OutputFieldFilter interface{ ExcludePath([]string, string) bool }\n```\nOutputFieldFilter is an invocation's user projection, independent of loaded columns and per-row read evidence. Paths follow the native JSON encoder.\n\n```go\nfunc SelectedOutputFields(ctx context.Context, value any) OutputFieldFilter\n```\n\n```go\ntype PanicError struct {\n\t// contains filtered or unexported fields\n}\n```\nPanicError retains recovery diagnostics privately. It deliberately does not unwrap the panic value: panic(response.Error) is not an intentional response. Cause and Stack are for operator diagnostics, never protocol serialization.\n\n```go\nfunc NewPanicError(operation string, cause any) *PanicError\n```\nNewPanicError must be called at the recovering boundary, before its stack unwinds. The standard server log receives diagnostics even without a logger.\n\n```go\nfunc (e *PanicError) Cause() any\n```\n\n```go\nfunc (e *PanicError) Error() string\n```\n\n```go\nfunc (e *PanicError) Format(s fmt.State, verb rune)\n```\n\n```go\nfunc (e *PanicError) Stack() []byte\n```\n\n```go\ntype PredicateEvaluator interface {\n\tContextType() reflect.Type\n\tNewContext(context.Context, xhandler.Binder, func(...any)) (any, error)\n}\n```\nPredicateEvaluator supplies a typed template context without exposing the concrete predicate implementation to SQL template compilation.\n\n```go\ntype PreparedQuery struct {\n\tSQL        string\n\tArgs       []any\n\tProjection ProjectionReader\n}\n```\nPreparedQuery contains bound source SQL and a projection executor owned by that source connection. No database or transaction is exposed to handlers.\n\n```go\ntype ProjectionReader interface {\n\tReadProjection(context.Context, ProjectionRequest) (any, error)\n}\n```\n\n```go\ntype ProjectionRequest struct {\n\tSQL     string\n\tArgs    []any\n\tRowType reflect.Type\n}\n```\n\n```go\ntype ProviderScope interface {\n\tProviders() []locator.Provider\n}\n```\nProviderScope supplies invocation-local providers without coupling protocol adapters to the concrete runtime engine.\n\n```go\ntype QueryPreparer interface {\n\tPrepareQuery(context.Context, any, xhandler.Binder, sqlx.ParameterResolver) (*PreparedQuery, error)\n}\n```\nQueryPreparer is an optional capability of a compiled SQL reader.\n\n```go\ntype ReadPlan struct {\n\tSQL  string\n\tArgs []any\n}\n```\nReadPlan contains the bound root query with its effective pagination. It grants no execution capability and does not promise whole-invocation purity.\n\n```go\ntype ReadPlanner interface {\n\tPlanRead(context.Context, any, xhandler.Binder, sqlx.ParameterResolver) (*ReadPlan, error)\n}\n```\n\n```go\ntype Reader interface {\n\tRead(ctx context.Context, input any, binder xhandler.Binder, resolver sqlx.ParameterResolver) (any, error)\n}\n```\nReader executes one read using input already prepared by the unified handler engine. SQL plans, connections, caches, and mutable reader state remain private to the implementation.\n\n```go\ntype ReaderCacheManager interface {\n\tCacheViews() []string\n\tInvalidateCache(context.Context, string, string) ([]CacheInvalidation, error)\n}\n```\nReaderCacheManager is a server-owned capability. HTTP callers require an independent administrator policy before this operation is invoked.\n\n```go\ntype ReaderInput struct {\n\tInput      any\n\tBinder     xhandler.Binder\n\tParameters sqlx.ParameterResolver\n}\n```\nReaderInput carries invocation values only. Bindly projections stay owned by the canonical registry contract and its DI adapter.\n\n```go\ntype ReaderInputPreparer func(context.Context, ...string) (*ReaderInput, error)\n```\n\n```go\ntype ReaderOptions struct {\n\tRefreshCache bool\n\tCacheOnly    bool\n\tQueryScope   *sqlxread.QueryScope\n}\n```\nReaderOptions are trusted invocation controls, shared by nested reader work. Cache ownership and identity remain with SQLX. Transactional views bypass shared caches, including refresh/writeback, and reject CacheOnly rather than silently falling back to SQL execution.\n\n```go\nfunc ReaderOptionsFromContext(ctx context.Context) ReaderOptions\n```\n\n```go\nfunc (o ReaderOptions) Context(ctx context.Context) context.Context\n```\n\n```go\ntype ReaderWarmer interface {\n\tWarmup(context.Context, ReaderWarmupInvocation) (int, error)\n}\n```\nReaderWarmer is an optional reader operation; native SQLX owns all cache data.\n\n```go\ntype ReaderWarmupInvocation struct {\n\tRequest    ReaderWarmupRequest\n\tInput      any\n\tBinder     xhandler.Binder\n\tParameters sqlx.ParameterResolver\n}\n```\nReaderWarmupInvocation carries canonical input already bound by the engine.\n\n```go\ntype ReaderWarmupRequest struct {\n\tView     string\n\tSettings *spec.CacheWarmupSettings\n}\n```\nReaderWarmupRequest selects one prepared view and its authored warmup policy. It is a trusted startup/operational request, not a transport parameter.\n\n```go\ntype ReaderWarmupTarget struct {\n\tView     string\n\tSettings *spec.CacheWarmupSettings\n}\n```\nReaderWarmupTarget is one materialized view warmup policy owned by a reader.\n\n```go\ntype ReaderWarmupTargeter interface {\n\tWarmupTargets() []ReaderWarmupTarget\n}\n```\nReaderWarmupTargeter exposes reader-owned warmup targets after compilation.\n\n```go\ntype ReportOrdering struct {\n\t// contains filtered or unexported fields\n}\n```\nReportOrdering is a trusted, invocation-local permission, not a selector or transport input. It changes only the ordering gate; SQL validation still runs.\n\n```go\nfunc ForwardReportOrdering(ctx context.Context, target ComponentTarget, view string) *ReportOrdering\n```\nForwardReportOrdering explicitly delegates the current report permission to a handler's designated reader. Ordinary handler calls have nothing to forward. Supplying this value on another target's request is rejected by runtime.\n\n```go\nfunc NewReportOrdering(target ComponentTarget, view string, fields ...string) *ReportOrdering\n```\nNewReportOrdering is for server-side report adapters targeting an exact route. Fields are selected scalar identities, not hidden relation dependencies. An empty set permits no ordering columns. SQL resolves and validates these names.\n\n","path":"github.com/viant/datly/exec","name":"exec","synopsis":"Package exec defines narrow execution ports consumed across Datly runtime and SQL ownership boundaries.","isRedistributable":true}
