Documentation
¶
Overview ¶
Package spec defines canonical authored and transcribed Datly metadata. It contains no runtime services, reflected field handles, or execution state.
Index ¶
- Constants
- func CloneSharedCases(caseSets map[string][]*CacheWarmupCase) map[string][]*CacheWarmupCase
- func DerivedMCPToolName(route *Route, fallback, suffix string) string
- func HashSnapshot(snapshot Snapshot) (string, error)
- func MCPRoute(route *Route) bool
- func MarshalSnapshot(snapshot Snapshot) ([]byte, error)
- func PublicRoute(route *Route) bool
- type BindSource
- type CORS
- type CacheSettings
- type CacheWarmupCase
- type CacheWarmupParam
- type CacheWarmupSettings
- type Cardinality
- type Codec
- type Column
- type Component
- type CubeComposeSettings
- type DeclarationKind
- type Diagnostic
- type EmbeddedSQLRef
- type FieldPath
- type GenerationSettings
- func (s *GenerationSettings) Clone() *GenerationSettings
- func (s *GenerationSettings) File(role, fallback string) string
- func (s GenerationSettings) IsZero() bool
- func (s *GenerationSettings) SQLFile(role, fallback string) string
- func (s *GenerationSettings) SQLFileFor(role, rootRole, fallback string) string
- func (s *GenerationSettings) SetSQLFile(role, file string) error
- func (s *GenerationSettings) SetSupportFile(role, file string) error
- func (s *GenerationSettings) ValidateFilePrefix() error
- type ImportSpec
- type Key
- type Kind
- type MCPExposure
- type MCPExposureKind
- type MatchStrategy
- type OutputSettings
- type Parameter
- type Partitioning
- type Predicate
- type Provenance
- type QuerySelectorBinding
- type Relation
- type RelationKind
- type RelationLink
- type ReportInputLayout
- type ReportSettings
- type ResourceFolder
- type Route
- type RouteActivation
- type RouteRef
- type SQLMethod
- type Selector
- type SelectorProperty
- type SelfReference
- type Settings
- type Severity
- type Snapshot
- type StaticContent
- type TypeContext
- type TypeRef
- type View
- type ViewBindings
- type ViewControls
- type ViewSource
- type WireSchema
Constants ¶
const ( RelationKindSubview RelationKind = "subview" RelationKindDerived RelationKind = "derived" MatchReadAll MatchStrategy = "read_all" MatchReadMatched MatchStrategy = "read_matched" MatchReadDerived MatchStrategy = "read_derived" )
const ( ViewControlUseConnector = "use_connector" ViewControlSetLimit = "set_limit" ViewControlOrderBy = "order_by" ViewControlUseCache = "use_cache" ViewControlCacheWarmup = "cache_warmup" ViewControlAllowNulls = "allow_nulls" ViewControlInMemory = "in_memory" ViewControlGroupable = "groupable" ViewControlGrouping = "grouping_enabled" ViewControlAllowedOrder = "allowed_order_by_columns" ViewControlCardinality = "cardinality" ViewControlSelfRef = "self_ref" ViewControlType = "type" ViewControlDest = "dest" ViewControlBatchSize = "batch_size" ViewControlBatchConcurrency = "batch_concurrency" ViewControlMatch = "match_strategy" ViewControlPartitioner = "set_partitioner" ViewControlPublish = "publish_parent" ViewControlConcurrency = "relational_concurrency" ViewControlEntityHooks = "lifecycle_type" ViewControlSelectorFields = "selector_fields" ViewControlSelectorOrderBy = "selector_order_by" ViewControlSelectorCriteria = "selector_criteria" ViewControlSelectorLimit = "selector_limit" ViewControlSelectorOffset = "selector_offset" ViewControlSelectorPage = "selector_page" ViewControlSelectorDefaultOrder = "selector_default_order" ViewControlSelectorDefaultLimit = "selector_default_limit" ViewControlSelectorNoLimit = "selector_no_limit" ViewControlSelectorFilterable = "selector_filterable" ViewControlSelectorNamespace = "selector_namespace" ViewControlSelectorSQLMethods = "selector_sql_methods" )
Variables ¶
This section is empty.
Functions ¶
func CloneSharedCases ¶
func CloneSharedCases(caseSets map[string][]*CacheWarmupCase) map[string][]*CacheWarmupCase
CloneSharedCases deep-copies named reusable case sets.
func DerivedMCPToolName ¶
DerivedMCPToolName derives a public MCP name for a synthetic endpoint such as a report cube from the source route's authored tool exposure.
func HashSnapshot ¶
func MCPRoute ¶
MCPRoute reports whether a route participates in the MCP catalog. An internal route with an explicit MCP exposure is intentionally MCP-only: it remains invokable by the component runtime but is omitted from public HTTP routing.
func MarshalSnapshot ¶
func PublicRoute ¶
PublicRoute reports whether a route should be published through external protocol catalogs. Internal routes remain available to component invocation and operational warmup.
Types ¶
type BindSource ¶
func (BindSource) RequestValue ¶
func (s BindSource) RequestValue() bool
RequestValue classifies durable values using canonical transport metadata. The invocation's HTTP request itself is reconstructed, never persisted.
type CORS ¶
type CORS struct {
AllowOrigins *[]string `json:"allowOrigins,omitempty" yaml:"AllowOrigins,omitempty"`
AllowMethods *[]string `json:"allowMethods,omitempty" yaml:"AllowMethods,omitempty"`
AllowHeaders *[]string `json:"allowHeaders,omitempty" yaml:"AllowHeaders,omitempty"`
ExposeHeaders *[]string `json:"exposeHeaders,omitempty" yaml:"ExposeHeaders,omitempty"`
AllowCredentials *bool `json:"allowCredentials,omitempty" yaml:"AllowCredentials,omitempty"`
MaxAge *int64 `json:"maxAge,omitempty" yaml:"MaxAge,omitempty"`
}
CORS preserves authored absence independently of explicit false/empty values. A nil route policy inherits the global policy; no policy enables nothing.
func DefaultCORS ¶
func DefaultCORS() *CORS
DefaultCORS allows noncredentialed cross-origin reads. Credentialed access requires an explicit origin policy. DisableCors disables cross-origin access.
type CacheSettings ¶
type CacheSettings struct {
SleepBetweenRetriesInMs int `json:"sleepBetweenRetriesInMs,omitempty"`
MaxRetries int `json:"maxRetries,omitempty"`
TotalTimeoutInMs int `json:"totalTimeoutInMs,omitempty"`
SocketTimeoutInMs int `json:"socketTimeoutInMs,omitempty"`
FailedRequestLimit int `json:"failedRequestLimit,omitempty"`
ResetFailuresInMs int `json:"resetFailuresInMs,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Name string `json:"name,omitempty"`
TTL string `json:"ttl,omitempty"`
Provider string `json:"provider,omitempty"`
Location string `json:"location,omitempty"`
TimeToLiveMs int `json:"timeToLiveMs,omitempty"`
Warmup *CacheWarmupSettings `json:"warmup,omitempty"`
// Warmups holds additional warmup definitions; the singular Warmup, when set, is always first.
Warmups []*CacheWarmupSettings `json:"warmups,omitempty"`
SharedCases map[string][]*CacheWarmupCase `json:"sharedCases,omitempty"`
}
func (*CacheSettings) Clone ¶
func (c *CacheSettings) Clone() *CacheSettings
Clone returns detached cache settings including every warmup definition.
func (*CacheSettings) EffectiveWarmups ¶
func (c *CacheSettings) EffectiveWarmups() ([]*CacheWarmupSettings, error)
EffectiveWarmups returns every normalized warmup definition: singular first, then plural in declaration order, with CaseRefs expanded from SharedCases.
func (*CacheSettings) HasWarmup ¶
func (c *CacheSettings) HasWarmup() bool
HasWarmup reports whether the settings define a singular or plural warmup.
type CacheWarmupCase ¶
type CacheWarmupCase struct {
Set []*CacheWarmupParam `json:"set,omitempty"`
FieldNames []string `json:"fieldNames,omitempty"`
}
func (*CacheWarmupCase) Clone ¶
func (c *CacheWarmupCase) Clone() *CacheWarmupCase
type CacheWarmupParam ¶
type CacheWarmupParam struct {
Name string `json:"name,omitempty"`
Values []string `json:"values,omitempty"`
ExcludeDefault bool `json:"excludeDefault,omitempty"`
}
func (*CacheWarmupParam) Clone ¶
func (p *CacheWarmupParam) Clone() *CacheWarmupParam
type CacheWarmupSettings ¶
type CacheWarmupSettings struct {
Name string `json:"name,omitempty"`
Priority int `json:"priority,omitempty"`
Limit *int `json:"limit,omitempty"`
MaxCases *int `json:"maxCases,omitempty"`
FieldNames []string `json:"fieldNames,omitempty"`
IndexColumn string `json:"indexColumn,omitempty"`
IndexParameter string `json:"indexParameter,omitempty"`
IndexMeta bool `json:"indexMeta,omitempty"`
Connector string `json:"connector,omitempty"`
CaseRefs []string `json:"caseRefs,omitempty"`
Cases []*CacheWarmupCase `json:"cases,omitempty"`
}
func EffectiveCacheWarmups ¶
func EffectiveCacheWarmups(warmup *CacheWarmupSettings, warmups []*CacheWarmupSettings, shared map[string][]*CacheWarmupCase) ([]*CacheWarmupSettings, error)
EffectiveCacheWarmups normalizes a singular-plus-plural warmup declaration to an ordered, detached warmup list. Each returned warmup owns an immutable copy of its cases: referenced case sets expand before inline cases, duplicates within one warmup are removed by canonical value identity, and no case slice is shared between warmups. Duplicate effective names or index identities are rejected instead of overwriting.
func (*CacheWarmupSettings) Clone ¶
func (s *CacheWarmupSettings) Clone() *CacheWarmupSettings
func (*CacheWarmupSettings) EffectiveName ¶
func (s *CacheWarmupSettings) EffectiveName() string
EffectiveName canonicalizes an absent Name from IndexParameter, falling back to IndexColumn.
type Cardinality ¶
type Cardinality string
const ( CardinalityOne Cardinality = "one" CardinalityMany Cardinality = "many" )
func NormalizeCardinality ¶
func NormalizeCardinality(value Cardinality) (Cardinality, error)
NormalizeCardinality accepts the canonical values and the title-case values emitted by the original Datly model. Resolved metadata always uses the canonical lower-case spelling.
func (*Cardinality) UnmarshalJSON ¶
func (c *Cardinality) UnmarshalJSON(data []byte) error
UnmarshalJSON normalizes legacy title-case cardinality at the authored-spec boundary instead of letting it reach exact runtime switches.
type Column ¶
type Column struct {
Name string `json:"name"`
DeleteMarker bool `json:"deleteMarker,omitempty"`
ConcurrencyToken bool `json:"concurrencyToken,omitempty"`
// NameInferred records Go-row discovery; it is not user alias authority.
NameInferred bool `json:"nameInferred,omitempty"`
Source string `json:"source,omitempty"`
Expression string `json:"expression,omitempty"`
DatabaseType string `json:"databaseType,omitempty"`
// ExplicitType is exact standalone CAST authority, including pointer semantics.
ExplicitType bool `json:"explicitType,omitempty"`
Type TypeRef `json:"type"`
Nullable bool `json:"nullable,omitempty"`
// Required is an authored non-null output declaration, not a table constraint
// or input validation rule. It suppresses inferred nullable pointers only.
Required bool `json:"required,omitempty"`
// NotNull records an authoritative table constraint, independently of reader nullability.
NotNull bool `json:"notNull,omitempty"`
Groupable *bool `json:"groupable,omitempty"`
PrimaryKey bool `json:"primaryKey,omitempty"`
AutoIncrement bool `json:"autoIncrement,omitempty"`
Unique bool `json:"unique,omitempty"`
Default *string `json:"default,omitempty"`
Tag string `json:"tag,omitempty"`
Codec *Codec `json:"codec,omitempty"`
}
Column is canonical compile-time metadata for one scalar view projection. Runtime field handles and database services are resolved by later owners.
func (*Column) EffectiveType ¶
EffectiveType returns the canonical Go value type represented by the column. Database nullability supplies pointer inference unless Required suppresses it or an explicit CAST specifies the exact Go type.
type Component ¶
type Component struct {
Static *StaticContent `json:"static,omitempty"`
Documentation xdocs.Source `json:"documentation,omitempty"`
Key Key `json:"key"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Example string `json:"example,omitempty"`
Settings *Settings `json:"settings,omitempty"`
TypeContext *TypeContext `json:"typeContext,omitempty"`
Routes []*Route `json:"routes,omitempty"`
Parameters []*Parameter `json:"params,omitempty"`
RootView *View `json:"rootView,omitempty"`
// Views contains independent DI-backed reads declared as view data points.
// They are not root relations unless an authored relation explicitly links them.
Views []*View `json:"views,omitempty"`
}
func (*Component) CacheWarmup ¶
func (c *Component) CacheWarmup() *CacheWarmupSettings
func (*Component) CacheWarmups ¶
func (c *Component) CacheWarmups() ([]*CacheWarmupSettings, error)
CacheWarmups returns every effective warmup definition: singular first, then plural in declaration order, with case references expanded per warmup.
func (*Component) RootSQL ¶
RootSQL returns the trimmed root SQL text for presence checks and SQL-shape detection. Callers that need the raw authored SQL should use RootSource().
func (*Component) RootSource ¶
func (c *Component) RootSource() *ViewSource
type CubeComposeSettings ¶
type CubeComposeSettings struct {
Enabled bool `json:"enabled,omitempty"`
MCPTool *bool `json:"mcpTool,omitempty"`
MaxCubes int `json:"maxCubes,omitempty"`
MaxLimit int `json:"maxLimit,omitempty"`
TimeoutMs int `json:"timeoutMs,omitempty"`
}
CubeComposeSettings enables a bounded, request-local composition of cube queries.
func (*CubeComposeSettings) Clone ¶
func (s *CubeComposeSettings) Clone() *CubeComposeSettings
func (*CubeComposeSettings) Normalize ¶
func (s *CubeComposeSettings) Normalize() *CubeComposeSettings
type DeclarationKind ¶
type DeclarationKind string
const ( DeclarationKindDefine DeclarationKind = "define" DeclarationKindSet DeclarationKind = "set" )
type Diagnostic ¶
type Diagnostic struct {
Severity Severity `json:"severity"`
Code string `json:"code"`
Message string `json:"message"`
Subject *Key `json:"subject,omitempty"`
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
}
func (Diagnostic) IsError ¶
func (d Diagnostic) IsError() bool
type EmbeddedSQLRef ¶
type FieldPath ¶
type FieldPath string
FieldPath is a metadata path used by selector policy. It remains a string because paths are authored and serialized, while runtime field access is compiled separately.
type GenerationSettings ¶
type GenerationSettings struct {
FilePrefix string `json:"filePrefix,omitempty"`
Template string `json:"template,omitempty"`
DescriptionResource string `json:"descriptionResource,omitempty"`
ViewFile string `json:"viewFile,omitempty"`
InputFile string `json:"inputFile,omitempty"`
OutputFile string `json:"outputFile,omitempty"`
RouterFile string `json:"routerFile,omitempty"`
HandlerFile string `json:"handlerFile,omitempty"`
LifecycleFile string `json:"lifecycleFile,omitempty"`
MutationFile string `json:"mutationFile,omitempty"`
ResourcesFile string `json:"resourcesFile,omitempty"`
LinksFile string `json:"linksFile,omitempty"`
TemplateFile string `json:"templateFile,omitempty"`
SupportFiles map[string]string `json:"supportFiles,omitempty"`
SQLFiles map[string]string `json:"sqlFiles,omitempty"`
}
GenerationSettings contains transcription controls that are consumed while producing a Go package and are not part of runtime component behavior.
func (*GenerationSettings) Clone ¶
func (s *GenerationSettings) Clone() *GenerationSettings
func (*GenerationSettings) File ¶
func (s *GenerationSettings) File(role, fallback string) string
File returns a transcription destination, or the caller's role-specific default.
func (GenerationSettings) IsZero ¶
func (s GenerationSettings) IsZero() bool
func (*GenerationSettings) SQLFile ¶
func (s *GenerationSettings) SQLFile(role, fallback string) string
SQLFile returns a configured SQL resource path or its readable default.
func (*GenerationSettings) SQLFileFor ¶
func (s *GenerationSettings) SQLFileFor(role, rootRole, fallback string) string
SQLFileFor returns an exact role override or inherits the root view's configured directory while retaining the role's default filename.
func (*GenerationSettings) SetSQLFile ¶
func (s *GenerationSettings) SetSQLFile(role, file string) error
SetSQLFile selects a generated SQL resource path for root or a named field/view role.
func (*GenerationSettings) SetSupportFile ¶
func (s *GenerationSettings) SetSupportFile(role, file string) error
SetSupportFile selects a named support product without depending on its filename.
func (*GenerationSettings) ValidateFilePrefix ¶
func (s *GenerationSettings) ValidateFilePrefix() error
ValidateFilePrefix restricts the optional filename prefix to a visible, package-local filename fragment. Empty means prefix-free defaults.
type ImportSpec ¶
type MCPExposure ¶
type MCPExposure struct {
Kind MCPExposureKind `json:"kind"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DescriptionPath string `json:"descriptionPath,omitempty"`
MIMEType string `json:"mimeType,omitempty"`
}
MCPExposure describes one explicit protocol exposure of a component route.
func (*MCPExposure) Clone ¶
func (e *MCPExposure) Clone() *MCPExposure
type MCPExposureKind ¶
type MCPExposureKind string
const ( MCPExposureTool MCPExposureKind = "tool" MCPExposureResource MCPExposureKind = "resource" MCPExposureResourceTemplate MCPExposureKind = "resourceTemplate" )
type MatchStrategy ¶
type MatchStrategy string
type OutputSettings ¶
type OutputSettings struct {
Exclude []string `json:"exclude,omitempty"`
OmitEmpty bool `json:"omitEmpty,omitempty"`
Title string `json:"title,omitempty"`
}
OutputSettings describes presentation policy independently of the row shape.
type Parameter ¶
type Parameter struct {
Name string `json:"name,omitempty"`
Declaration DeclarationKind `json:"declaration,omitempty"`
Source BindSource `json:"source,omitempty"`
TypeExpr string `json:"typeExpr,omitempty"`
OutputTypeExpr string `json:"outputTypeExpr,omitempty"`
// DeclarationSQL preserves the `/* ... */` SQL/comment body attached to a
// declaration as an authored input to later transcribe stages.
DeclarationSQL string `json:"declarationSQL,omitempty"`
Tag string `json:"tag,omitempty"`
Cardinality string `json:"cardinality,omitempty"`
Required *bool `json:"required,omitempty"`
MinAllowedRecords *int `json:"minAllowedRecords,omitempty"`
MaxAllowedRecords *int `json:"maxAllowedRecords,omitempty"`
ExpectedReturned *int `json:"expectedReturned,omitempty"`
Cacheable *bool `json:"cacheable,omitempty"`
When string `json:"when,omitempty"`
Scope string `json:"scope,omitempty"`
With string `json:"with,omitempty"`
Activation *RouteActivation `json:"activation,omitempty"`
MCP *bool `json:"mcp,omitempty"`
PathMCP *bool `json:"pathMcp,omitempty"`
ResourceRef string `json:"resourceRef,omitempty"`
Value *string `json:"value,omitempty"`
Async bool `json:"async,omitempty"`
ErrorStatusCode int `json:"errorStatusCode,omitempty"`
ErrorMessage string `json:"errorMessage,omitempty"`
Description string `json:"description,omitempty"`
Example string `json:"example,omitempty"`
EmitOutput bool `json:"emitOutput,omitempty"`
Predicates []*Predicate `json:"predicates,omitempty"`
Codec *Codec `json:"codec,omitempty"`
QuerySelector *QuerySelectorBinding `json:"querySelector,omitempty"`
FormatSelector bool `json:"formatSelector,omitempty"`
WireSchema *WireSchema `json:"wireSchema,omitempty"`
WireSchemas map[string]*WireSchema `json:"wireSchemas,omitempty"`
Raw string `json:"raw,omitempty"`
}
func EffectiveParameters ¶
EffectiveParameters returns authored parameters after #define declarations replace declaration-shaped #set entries for the same logical data point.
func (*Parameter) Identity ¶
Identity returns the canonical key for one authored data point. Input and output declarations may intentionally share a name, so name alone is not an identity.
func (*Parameter) IsDerivedOutput ¶
IsDerivedOutput recognizes canonical derived output and the original DQL/ package spelling at the metadata input boundary. Generators emit "derived".
func (*Parameter) IsTransportInput ¶
IsTransportInput reports whether a parameter is populated by request-scoped transport providers rather than a named runtime capability.
type Partitioning ¶
type Partitioning struct {
Type string `json:"type,omitempty"`
Arguments []string `json:"arguments,omitempty"`
Concurrency int `json:"concurrency,omitempty"`
}
func (*Partitioning) Clone ¶
func (p *Partitioning) Clone() *Partitioning
type Predicate ¶
type Predicate struct {
Group int `json:"group,omitempty"`
Name string `json:"name,omitempty"`
Args []string `json:"args,omitempty"`
ApplyWhenAbsent bool `json:"applyWhenAbsent,omitempty"`
}
func (*Predicate) UnmarshalJSON ¶
UnmarshalJSON rejects the removed ensure spelling instead of silently disabling absent-input predicate application.
type Provenance ¶
type QuerySelectorBinding ¶
type QuerySelectorBinding struct {
View string `json:"view"`
Property SelectorProperty `json:"property"`
}
type Relation ¶
type Relation struct {
// Tag contains authored Go tags for the relation holder, not child columns.
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
Kind RelationKind `json:"kind,omitempty"`
Holder string `json:"holder,omitempty"`
Cardinality Cardinality `json:"cardinality,omitempty"`
Join string `json:"join,omitempty"`
ParentNamespace string `json:"parentNamespace,omitempty"`
MatchStrategy MatchStrategy `json:"matchStrategy,omitempty"`
View *View `json:"view,omitempty"`
On []*RelationLink `json:"on,omitempty"`
}
Relation is canonical authored/compiled metadata for an ordinary child view. A DerivedView uses the derived relation kind, not a separate view slot or lifecycle. Counts and aggregates are examples, not a separate model.
type RelationKind ¶
type RelationKind string
func (*RelationKind) UnmarshalJSON ¶
func (k *RelationKind) UnmarshalJSON(data []byte) error
UnmarshalJSON normalizes stored original relation metadata into the current DerivedView model. Unrelated relation kinds retain their authored values.
type RelationLink ¶
type RelationLink struct {
ParentNamespace string `json:"parentNamespace,omitempty"`
ParentColumn string `json:"parentColumn,omitempty"`
ChildNamespace string `json:"childNamespace,omitempty"`
ChildColumn string `json:"childColumn,omitempty"`
}
RelationLink preserves one AST-proven parent/child equality. Go field indexes are resolved later by the reader compiler and never enter spec.
type ReportInputLayout ¶
type ReportInputLayout struct {
Dimensions string `json:"dimensions,omitempty"`
Measures string `json:"measures,omitempty"`
Filters string `json:"filters,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
Limit string `json:"limit,omitempty"`
Offset string `json:"offset,omitempty"`
}
ReportInputLayout maps report semantics to input struct fields. Generated report inputs use canonical field names by default and require no layout.
func (*ReportInputLayout) Clone ¶
func (s *ReportInputLayout) Clone() *ReportInputLayout
type ReportSettings ¶
type ReportSettings struct {
Compose *CubeComposeSettings `json:"compose,omitempty"`
Enabled bool `json:"enabled,omitempty"`
MCPTool *bool `json:"mcpTool,omitempty"`
LinkedInputType string `json:"linkedInputType,omitempty"`
InputLayout *ReportInputLayout `json:"inputLayout,omitempty"`
}
func (*ReportSettings) Clone ¶
func (s *ReportSettings) Clone() *ReportSettings
type ResourceFolder ¶
type ResourceFolder struct {
Skills []string `json:"skills,omitempty"`
Namespace string `json:"namespace"`
Root string `json:"root"`
URIPrefix string `json:"uriPrefix"`
}
ResourceFolder is target-neutral authored MCP publication metadata.
func (ResourceFolder) Clone ¶
func (f ResourceFolder) Clone() ResourceFolder
func (ResourceFolder) Validate ¶
func (f ResourceFolder) Validate() error
type Route ¶
type Route struct {
CORS *CORS `json:"cors,omitempty"`
Method string `json:"method"`
Path string `json:"path"`
Name string `json:"name,omitempty"`
Internal bool `json:"internal,omitempty"`
Marshaller string `json:"marshaller,omitempty"`
Handler string `json:"handler,omitempty"`
APIKeyHeader string `json:"apiKeyHeader,omitempty"`
APIKeyValue string `json:"apiKeyValue,omitempty"`
MCP []*MCPExposure `json:"mcp,omitempty"`
}
type RouteActivation ¶
type RouteActivation struct {
URI string `json:"uri"`
}
RouteActivation limits a parameter to an exact authored path or the original Datly relative placeholder suffix (for example /{id}).
func (*RouteActivation) Matches ¶
func (a *RouteActivation) Matches(path string) bool
type RouteRef ¶
RouteRef is the canonical identity stored by a component binding source.
func ParseRouteRef ¶
type SQLMethod ¶
SQLMethod permits one named SQL function in client criteria. Argument types are canonical Go type expressions resolved when the reader is compiled.
type Selector ¶
type Selector struct {
// Specified distinguishes authored permissions (including false) from
// defaults inferred from query-selector bindings. Use SetPermission to author.
Specified []SelectorProperty `json:"specified,omitempty"`
Namespace string `json:"namespace,omitempty"`
AllowFields bool `json:"allowFields,omitempty"`
AllowOrderBy bool `json:"allowOrderBy,omitempty"`
AllowCriteria bool `json:"allowCriteria,omitempty"`
AllowLimit bool `json:"allowLimit,omitempty"`
AllowOffset bool `json:"allowOffset,omitempty"`
AllowPage bool `json:"allowPage,omitempty"`
DefaultOrder string `json:"defaultOrder,omitempty"`
DefaultLimit int `json:"defaultLimit,omitempty"`
NoLimit bool `json:"noLimit,omitempty"`
Filterable []FieldPath `json:"filterable,omitempty"`
SQLMethods []SQLMethod `json:"sqlMethods,omitempty"`
Orderable []FieldPath `json:"orderable,omitempty"`
OrderAliases map[string]FieldPath `json:"orderAliases,omitempty"`
}
Selector is immutable per-view query-selector policy. Request-time selector values live in xdatly/state.Selector and must not be stored here.
func (*Selector) PermissionSpecified ¶ added in v1.1.0
func (s *Selector) PermissionSpecified(property SelectorProperty) bool
func (*Selector) SetPermission ¶ added in v1.1.0
func (s *Selector) SetPermission(property SelectorProperty, enabled bool) error
SetPermission authors a permission independently of input binding. In particular, an explicit false must not be replaced by binding inference.
type SelectorProperty ¶
type SelectorProperty string
const ( SelectorPropertyFields SelectorProperty = "fields" SelectorPropertyOrderBy SelectorProperty = "orderBy" SelectorPropertyOffset SelectorProperty = "offset" SelectorPropertyLimit SelectorProperty = "limit" SelectorPropertyPage SelectorProperty = "page" SelectorPropertyCriteria SelectorProperty = "criteria" )
func SelectorPropertyForParam ¶
func SelectorPropertyForParam(name string) (SelectorProperty, bool)
type SelfReference ¶
type SelfReference struct {
Holder string `json:"holder"`
Child string `json:"child"`
Parent string `json:"parent"`
}
SelfReference describes how flat rows of one view form a tree.
type Settings ¶
type Settings struct {
Mutation string `json:"mutation,omitempty"`
SequenceStrategy string `json:"sequenceStrategy,omitempty"`
MCPFolders []ResourceFolder `json:"mcpFolders,omitempty"`
IgnoreEmptyQueryParameters *bool `json:"ignoreEmptyQueryParameters,omitempty"`
DefaultConnector string `json:"defaultConnector,omitempty"`
Report *ReportSettings `json:"report,omitempty"`
Cache *CacheSettings `json:"cache,omitempty"`
Generation *GenerationSettings `json:"generation,omitempty"`
InputType string `json:"inputType,omitempty"`
OutputType string `json:"outputType,omitempty"`
JSONMarshalType string `json:"jsonMarshalType,omitempty"`
JSONUnmarshalType string `json:"jsonUnmarshalType,omitempty"`
XMLUnmarshalType string `json:"xmlUnmarshalType,omitempty"`
Format string `json:"format,omitempty"`
DateFormat string `json:"dateFormat,omitempty"`
Output *OutputSettings `json:"output,omitempty"`
CaseFormat string `json:"caseFormat,omitempty"`
Const map[string]string `json:"const,omitempty"`
WarmupTarget *RouteRef `json:"warmupTarget,omitempty"`
}
func (*Settings) ValidateSequenceStrategy ¶
ValidateSequenceStrategy checks the component's optional native allocation selection. Empty delegates to the dialect; unsafe/read-only strategies are not part of the managed writer setting.
type Snapshot ¶
type Snapshot struct {
Version string `json:"version"`
Keys []Key `json:"keys,omitempty"`
Types []TypeRef `json:"types,omitempty"`
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
Meta []Provenance `json:"provenance,omitempty"`
}
type StaticContent ¶
type StaticContent struct {
Path string `json:"path"`
Namespace string `json:"namespace,omitempty"`
ContentURL string `json:"contentURL,omitempty"`
Root string `json:"root,omitempty"`
CORS *CORS `json:"cors,omitempty"`
APIKeyHeader string `json:"apiKeyHeader,omitempty"`
APIKeyValue string `json:"apiKeyValue,omitempty"`
}
StaticContent maps a resource subtree to one literal HTTP prefix. Namespace selects the shared resource.Store. ContentURL selects operator AFS authority. Exactly one source is required; Root is relative to that source.
func (*StaticContent) Clone ¶
func (s *StaticContent) Clone() *StaticContent
func (*StaticContent) Validate ¶
func (s *StaticContent) Validate() error
type TypeContext ¶
type TypeContext struct {
// PackagePath is the destination explicitly authored by #package.
PackagePath string `json:"packagePath,omitempty"`
DefaultPackage string `json:"defaultPackage,omitempty"`
Imports []ImportSpec `json:"imports,omitempty"`
}
func (*TypeContext) Clone ¶
func (c *TypeContext) Clone() *TypeContext
type TypeRef ¶
type TypeRef struct {
Package string `json:"package,omitempty"`
Name string `json:"name"`
// Pointer applies to the named element, inside a slice when Cardinality is many.
Pointer bool `json:"pointer,omitempty"`
Cardinality Cardinality `json:"cardinality,omitempty"`
// SlicePointer distinguishes *[]T from []*T (Pointer with Cardinality many).
SlicePointer bool `json:"slicePointer,omitempty"`
}
type View ¶
type View struct {
Key Key `json:"key"`
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
// Auxiliary is generation-only mutation intent. Reads and business data
// remain part of the canonical view graph; runtime data.View does not own it.
Auxiliary bool `json:"auxiliary,omitempty"`
// InMemory marks a child populated by its parent hook. Source is retained
// for column discovery only; runtime traverses the existing holder rows.
InMemory bool `json:"inMemory,omitempty"`
// TypeName and Dest retain authored package-generation choices. Runtime
// view resolution deliberately ignores both fields.
TypeName string `json:"typeName,omitempty"`
Dest string `json:"dest,omitempty"`
// EntityHooks is generation-only metadata for the authored entity hook reference.
EntityHooks string `json:"entityHooks,omitempty"`
Cardinality Cardinality `json:"cardinality,omitempty"`
AllowNulls *bool `json:"allowNulls,omitempty"`
Groupable *bool `json:"groupable,omitempty"`
Columns []*Column `json:"columns,omitempty"`
Source *ViewSource `json:"source,omitempty"`
Selector *Selector `json:"selector,omitempty"`
Partitioning *Partitioning `json:"partitioning,omitempty"`
SelfReference *SelfReference `json:"selfReference,omitempty"`
BatchSize int `json:"batchSize,omitempty"`
BatchConcurrency int `json:"batchConcurrency,omitempty"`
PublishParent bool `json:"publishParent,omitempty"`
RelationalConcurrency int `json:"relationalConcurrency,omitempty"`
Relations []*Relation `json:"relations,omitempty"`
}
func (*View) CanonicalName ¶
func (*View) EnableQuerySelector ¶ added in v1.1.0
func (v *View) EnableQuerySelector(property SelectorProperty) error
EnableQuerySelector supplies a default permission for a declared binding. An explicitly authored view policy always wins, including an explicit deny.
func (*View) Identity ¶
Identity returns the canonical metadata identity of an independent view. Namespace is part of the identity because one component may contain the same logical view name in more than one SQL namespace.
func (*View) RuntimeSource ¶ added in v1.1.0
func (v *View) RuntimeSource() *ViewSource
RuntimeSource excludes discovery-only SQL without mutating authored metadata.
type ViewBindings ¶
type ViewBindings struct {
Connector string `json:"connector,omitempty"`
CacheName string `json:"cacheName,omitempty"`
CacheWarmup string `json:"cacheWarmup,omitempty"`
}
ViewBindings are the resource/cache controls derived from authored SQL-ish view-control calls: the connector the view reads from and its cache identity and warmup mode. Unlike ViewControls (query shaping), bindings are never overlaid by the runtime selector and flow unchanged into the prepared artifact, where the cache and warmup paths consume them. "Bindings" here refers to the view's resource bindings, distinct from per-request parameter binding.
func (*ViewBindings) Clone ¶
func (b *ViewBindings) Clone() *ViewBindings
func (*ViewBindings) IsZero ¶
func (b *ViewBindings) IsZero() bool
type ViewControls ¶
type ViewControls struct {
OrderBy string `json:"orderBy,omitempty"`
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
ViewControls are the query-shaping controls derived from authored SQL-ish view-control calls and overlaid by the runtime selector. They govern the result-set shape only: they are applied to the SQL text at prepare time and do not flow into the prepared artifact (see ViewBindings for the resource/cache controls that do). Limit and Offset are typed numeric controls: a nil pointer means "unset" (no clause is emitted), which keeps "unset" distinct from an explicit zero (LIMIT 0/OFFSET 0).
func (*ViewControls) Clone ¶
func (c *ViewControls) Clone() *ViewControls
func (*ViewControls) IsZero ¶
func (c *ViewControls) IsZero() bool
type ViewSource ¶
type ViewSource struct {
Table string `json:"table,omitempty"`
SQL string `json:"sql,omitempty"`
// URI preserves the source resource identity independently of available
// SQL. Embeds contains only inline substitutions within SQL.
URI string `json:"uri,omitempty"`
Embeds []*EmbeddedSQLRef `json:"embeds,omitempty"`
Controls *ViewControls `json:"controls,omitempty"`
Bindings *ViewBindings `json:"bindings,omitempty"`
}
func (*ViewSource) Clone ¶
func (s *ViewSource) Clone() *ViewSource
type WireSchema ¶
type WireSchema struct {
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
Nullable bool `json:"nullable,omitempty"`
}
WireSchema is discovery-only metadata for a public wire contract. Runtime binding continues to use the compiled source and destination types.
func (*WireSchema) Clone ¶
func (s *WireSchema) Clone() *WireSchema
Source Files
¶
- cache_warmup.go
- column.go
- component.go
- component_accessors.go
- component_clone.go
- cors.go
- cube_compose.go
- derived.go
- diagnostic.go
- doc.go
- generation_files.go
- key.go
- mcp.go
- parameters.go
- predicate.go
- provenance.go
- query_selector.go
- resource_folder.go
- route_ref.go
- route_visibility.go
- selector.go
- self_reference.go
- sequence_strategy.go
- snapshot.go
- source_replay.go
- state.go
- static.go
- typeref.go
- view.go
- view_bindings.go
- view_clone.go
- view_controls.go