Documentation
¶
Overview ¶
Package requel is the embeddable, read-only RQL compiler.
A Model loads one ontology repository and exposes its catalog, object graph, callable contracts, and deterministic compilation boundary. The package does not open connectors or execute the plans it produces; hosts retain ownership of transactions, credentials, auditing, scheduling, and transport.
Index ¶
- Constants
- func EvaluatePredicate(predicate Predicate, row map[string]any) (bool, error)
- func FindAndLoad(start string) (*Model, *Diagnostic)
- func Load(root string) (*Model, *Diagnostic)
- func LoadModel(ctx context.Context, modelFS fs.FS, manifestPath string, options LoadOptions) (*Model, Diagnostics)
- func LoadWithOptions(root string, options LoadOptions) (*Model, *Diagnostic)
- func PredicateText(predicate Predicate) string
- type ActionContract
- type ActionEffect
- type ActionInput
- type ActionObjectRef
- type ActionPredicate
- type ActionVocabulary
- type Bind
- type Call
- type CanonicalCell
- type CanonicalKind
- type CanonicalRow
- type Catalog
- type CatalogConnector
- type CatalogEdge
- type CatalogEntrypoint
- type CatalogNamespace
- type CatalogProject
- type CatalogRelation
- type CatalogTarget
- type CompileOptions
- type CompiledFunction
- type ComposedEdge
- type DatasetColumn
- type DatasetListRequest
- type DatasetQueryPlan
- type DecodedObjectRow
- type DecodedResult
- type DerivedRelationPlan
- type DerivedRelationRequest
- type Diagnostic
- type Diagnostics
- type Dimension
- type Filterable
- type FunctionColumnLabel
- type FunctionColumnType
- type FunctionContract
- type FunctionDataFlow
- type FunctionError
- type FunctionExecution
- type FunctionIncompleteReason
- type FunctionOrder
- type FunctionProvenance
- type FunctionResultColumn
- type FunctionRun
- type FunctionSchema
- type FunctionStepRun
- type FunctionTable
- type FunctionTerminalCall
- type FunctionTerminalExecutor
- type FunctionTerminalResult
- type Graph
- type GraphEdge
- type GraphObject
- type GraphPair
- type GraphPath
- type Guard
- type HostModule
- type LoadOptions
- type Metric
- type Model
- func (m *Model) ActionAllowed(name string, ref ActionObjectRef, target, input map[string]any) (bool, error)
- func (m *Model) ActionAllowedFor(name string, principal Principal) (bool, error)
- func (m *Model) ActionContract(name string) (*ActionContract, bool)
- func (m *Model) ActionContracts() []ActionContract
- func (m *Model) ActionRequiresReview(name string, ref ActionObjectRef, target, input map[string]any) (bool, error)
- func (m *Model) Catalog() *Catalog
- func (m *Model) CatalogHash() string
- func (m *Model) Compile(ctx context.Context, call Call) (*Plan, *Diagnostic)
- func (m *Model) CompileDatasetList(ctx context.Context, request DatasetListRequest) (*DatasetQueryPlan, *Diagnostic)
- func (m *Model) CompileDerivedRelation(ctx context.Context, request DerivedRelationRequest) (*DerivedRelationPlan, *Diagnostic)
- func (m *Model) CompileFunction(ctx context.Context, call Call) (*CompiledFunction, *Diagnostic)
- func (m *Model) CompileObjectAggregate(ctx context.Context, request ObjectAggregateRequest) (*ObjectAggregatePlan, *Diagnostic)
- func (m *Model) CompileObjectGet(ctx context.Context, request ObjectGetRequest) (*ObjectQueryPlan, *Diagnostic)
- func (m *Model) CompileObjectKeyProbe(ctx context.Context, request ObjectKeyProbeRequest) (*ObjectKeyProbePlan, *Diagnostic)
- func (m *Model) CompileObjectList(ctx context.Context, request ObjectListRequest) (*ObjectQueryPlan, *Diagnostic)
- func (m *Model) CompileObjectTraversal(ctx context.Context, request ObjectTraversalRequest) (*ObjectQueryPlan, *Diagnostic)
- func (m *Model) DeploymentHash() string
- func (m *Model) EvaluateOperationalModules(ctx context.Context, paths []string) *Diagnostic
- func (m *Model) Graph() *Graph
- func (m *Model) Hash() string
- func (m *Model) Inspect(entrypoint string) (map[string]any, *Diagnostic)
- func (m *Model) MaxRows() int
- func (m *Model) Object(name string) (*ObjectType, bool)
- func (m *Model) Objects() []ObjectType
- func (m *Model) RenderAction(name string, ref ActionObjectRef, target, input map[string]any) ([]ActionEffect, error)
- func (m *Model) Root() string
- func (m *Model) SourceHash() string
- type ObjectAggregateMeasure
- type ObjectAggregatePlan
- type ObjectAggregateRequest
- type ObjectColumn
- type ObjectDisplay
- type ObjectExprOp
- type ObjectFilter
- type ObjectGetRequest
- type ObjectKeyProbePlan
- type ObjectKeyProbeRequest
- type ObjectLink
- type ObjectListRequest
- type ObjectQueryPlan
- type ObjectRef
- type ObjectSort
- type ObjectTraversalRequest
- type ObjectType
- type ObjectTypeValue
- type Plan
- type PlanKind
- type Predicate
- type PredicateOperand
- type Principal
- type Property
- type ResultCardinality
- type SQLPlan
- type SourceAccess
- type SourceDecorationRequest
- type SourceDecorator
- type SourcePlan
- type SourceWrapper
- type TerminalRead
- type UnboundEdge
- type UnresolvedBinding
- type ViaHop
- type Warning
Constants ¶
const ( FunctionString = functionruntime.StringType FunctionInteger = functionruntime.IntegerType FunctionNumber = functionruntime.NumberType FunctionBoolean = functionruntime.BooleanType FunctionDate = functionruntime.DateType FunctionTimestamp = functionruntime.TimestampType FunctionDecimal = functionruntime.DecimalType )
const ( // APIVersion identifies the supported Go embedding contract independently // from the standalone application's release version. APIVersion = "requel.go.v2" // LangVersion is the RQL language version implemented by this compiler. LangVersion = engine.LangVersion // StdVersion is the bundled RQL standard-library version. StdVersion = engine.StdVersion // CatalogVersion identifies the serialized catalog contract. CatalogVersion = engine.CatalogVersion // PlanVersion identifies every serialized plan produced by this package. PlanVersion = "requel.plan.v2" )
const ( ObjectAnd = engine.ObjectAnd ObjectOr = engine.ObjectOr ObjectNot = engine.ObjectNot ObjectPredicate = engine.ObjectPredicate )
Variables ¶
This section is empty.
Functions ¶
func EvaluatePredicate ¶ added in v0.3.0
EvaluatePredicate evaluates the shared closed predicate IR. It intentionally exposes no arbitrary callback, reflection, or code execution facility.
func FindAndLoad ¶
func FindAndLoad(start string) (*Model, *Diagnostic)
FindAndLoad finds the nearest requel.toml at or above start and loads it.
func Load ¶
func Load(root string) (*Model, *Diagnostic)
Load validates a repository and builds its strict capability catalog without opening a connector.
func LoadModel ¶
func LoadModel(ctx context.Context, modelFS fs.FS, manifestPath string, options LoadOptions) (*Model, Diagnostics)
LoadModel snapshots a repository supplied as an fs.FS into compiler-owned immutable memory. manifestPath identifies requel.toml inside that filesystem; its directory becomes the confined model root.
func LoadWithOptions ¶
func LoadWithOptions(root string, options LoadOptions) (*Model, *Diagnostic)
LoadWithOptions loads a model with a closed trusted host-module set.
func PredicateText ¶ added in v0.3.0
PredicateText renders the shared closed predicate IR for catalogs, review explanations, and audit output. It never evaluates or interpolates code.
Types ¶
type ActionContract ¶ added in v0.3.0
type ActionContract struct {
Name string `json:"name"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
DeniedReason string `json:"denied_reason,omitempty"`
// Target and Creates are mutually exclusive: an action acts on an
// existing row of Target, or births a record of Creates.
Target string `json:"target,omitempty"`
Creates string `json:"creates,omitempty"`
Inputs []ActionInput `json:"inputs"`
// Reads names target properties the effects and predicates may see.
Reads []string `json:"reads"`
// The declared effect envelope, default-deny. Writes members are
// "Object.property" and name declared writable properties; Schedules
// members name declared actions; Emits and Invokes name host
// vocabularies the host validates against its own registries.
Emits []string `json:"emits"`
Writes []string `json:"writes"`
Schedules []string `json:"schedules"`
Invokes []string `json:"invokes"`
AllowedForShape string `json:"allowed_for_shape"`
// The row predicates' declared shapes — always, never, or conditional —
// never their verdicts, which are questions about data.
AllowedIfShape string `json:"allowed_if_shape"`
RequiresReviewShape string `json:"requires_review_shape"`
// AllowedIf and RequiresReview carry the structured predicate tree when
// the declaration used the closed vocabulary (shape "structured"), with
// a deterministic text rendering beside each: the tree is
// host-evaluable without Starlark, the text is what a reviewer reads.
// Opaque function predicates leave these empty.
AllowedIf *ActionPredicate `json:"allowed_if,omitempty"`
AllowedIfText string `json:"allowed_if_text,omitempty"`
RequiresReview *ActionPredicate `json:"requires_review,omitempty"`
RequiresReviewText string `json:"requires_review_text,omitempty"`
CorrelationFrom string `json:"correlation_from,omitempty"`
// Dependencies names every object type this contract touches — its
// subject, its writes targets, and its reference inputs — deduplicated
// and sorted, so impact analysis over an object includes the constructs
// that mutate it, not only the ones that read it.
Dependencies []string `json:"dependencies"`
File string `json:"file"`
Line int `json:"line"`
}
ActionContract is one compiled action declaration: the reviewable description of a governed write, produced by `action.make` and validated against the object catalog it references. It is a declaration, not an operation — Requel performs no host operation, so the catalog states what an action is and its pure renderer can only return inert intents. The host owns authorization, planning, reviews, execution and the record of what happened; this contract is the one authoritative description of what it is running.
type ActionEffect ¶ added in v0.3.0
type ActionEffect = engine.ActionEffect
type ActionInput ¶ added in v0.3.0
type ActionInput struct {
Name string `json:"name"`
Type string `json:"type"`
IsNullable bool `json:"is_nullable,omitempty"`
ObjectType string `json:"object_type,omitempty"`
Reads []string `json:"reads,omitempty"`
Doc string `json:"doc,omitempty"`
Label string `json:"label,omitempty"`
Labels []string `json:"labels,omitempty"`
Format string `json:"format,omitempty"`
DefaultValue any `json:"default,omitempty"`
HasDefault bool `json:"has_default,omitempty"`
Minimum *float64 `json:"min,omitempty"`
Maximum *float64 `json:"max,omitempty"`
}
ActionInput is one declared scalar, typed object reference, or bounded object-set input.
type ActionObjectRef ¶ added in v0.3.0
type ActionObjectRef = engine.ActionObjectRef
ActionObjectRef and ActionEffect are inert values returned by pure action rendering. Requel cannot resolve, authorize, persist, or execute either.
type ActionPredicate ¶ added in v0.3.0
type ActionPredicate struct {
Kind string `json:"kind"`
Column string `json:"column,omitempty"`
Op string `json:"op,omitempty"`
Value any `json:"value,omitempty"`
Input string `json:"input,omitempty"`
Children []ActionPredicate `json:"children,omitempty"`
}
ActionPredicate is one node of the closed predicate vocabulary — compare | all | any | not — over the subject's properties, with literal or declared caller-input operands. A host evaluates the tree directly; the catalog renders it as deterministic text.
type ActionVocabulary ¶ added in v0.3.0
type ActionVocabulary struct {
Events []string `json:"events"`
Connections []string `json:"connections"`
}
ActionVocabulary names the host capabilities action contracts may reference: declared event kinds and declared outbound connections.
type Bind ¶
type Bind struct {
Ordinal int `json:"ordinal"`
Type string `json:"type"`
Value any `json:"value"`
}
Bind is one driver argument in ordinal order.
type Call ¶
type Call struct {
Entrypoint string `json:"entrypoint"`
Params map[string]any `json:"params,omitempty"`
Principal Principal `json:"principal,omitempty"`
Now time.Time `json:"now,omitempty"`
// Dialect overrides the repository dialect for hosts that deliberately
// execute against another compatible engine. Empty uses requel.toml.
Dialect string `json:"dialect,omitempty"`
// RelationBindings is trusted, compile-local physical placement. Compiled
// SQL contains these addresses while plan provenance remains logical.
RelationBindings map[string]string `json:"-"`
}
Call is one invocation of a governed RQL entrypoint.
type CanonicalCell ¶
type CanonicalCell struct {
Kind CanonicalKind
Value any
}
type CanonicalKind ¶
type CanonicalKind string
CanonicalKind is the closed, driver-independent value union accepted by the semantic decoder. Hosts adapt database values into this union; all object, property, identity, and cardinality rules remain in Requel.
const ( CanonicalNull CanonicalKind = "null" CanonicalString CanonicalKind = "string" CanonicalInteger CanonicalKind = "integer" CanonicalNumber CanonicalKind = "number" CanonicalDecimal CanonicalKind = "decimal" CanonicalBoolean CanonicalKind = "boolean" CanonicalDate CanonicalKind = "date" CanonicalTimestamp CanonicalKind = "timestamp" CanonicalJSON CanonicalKind = "json" )
type CanonicalRow ¶
type CanonicalRow []CanonicalCell
type Catalog ¶
type Catalog struct {
Object string `json:"object"`
Version string `json:"version"`
DefinitionFingerprint string `json:"definition_fingerprint"`
Project CatalogProject `json:"project"`
Entrypoints []CatalogEntrypoint `json:"entrypoints"`
Relations []CatalogRelation `json:"relations"`
Namespaces []CatalogNamespace `json:"namespaces"`
Connectors []CatalogConnector `json:"connectors"`
Targets []CatalogTarget `json:"targets"`
AllowedFlows []string `json:"allowed_flows"`
CapabilityEdges []CatalogEdge `json:"capability_edges"`
Objects []ObjectType `json:"objects"`
Actions []ActionContract `json:"actions,omitempty"`
ObjectGraph *Graph `json:"object_graph"`
}
Catalog is the complete, generated capability catalog for one model. It is a transport-neutral value: no connector handle or runtime readiness state can appear in it.
type CatalogConnector ¶
type CatalogEdge ¶
type CatalogEntrypoint ¶
type CatalogNamespace ¶
type CatalogProject ¶
type CatalogRelation ¶
type CatalogTarget ¶
type CompileOptions ¶
type CompileOptions struct {
SourceDecorator SourceDecorator
// RelationBindings is trusted, compile-local physical placement. It is
// applied before the compiler calculates the returned plan fingerprint.
RelationBindings map[string]string
}
type CompiledFunction ¶ added in v0.3.0
type CompiledFunction struct {
// contains filtered or unexported fields
}
CompiledFunction is an immutable executable handle. Its representation stays private so compiler/runtime package moves do not become host API changes.
func (*CompiledFunction) Contract ¶ added in v0.3.0
func (compiled *CompiledFunction) Contract() FunctionContract
func (*CompiledFunction) Execute ¶ added in v0.3.0
func (compiled *CompiledFunction) Execute(ctx context.Context, options FunctionExecution) (*FunctionRun, *FunctionError)
type ComposedEdge ¶
type ComposedEdge struct {
From string `json:"from"`
Name string `json:"name"`
To string `json:"to,omitempty"`
Hops []ViaHop `json:"hops"`
Cardinality string `json:"cardinality,omitempty"`
Optional bool `json:"optional"`
GuardChain []string `json:"guard_chain"`
File string `json:"file"`
Line int `json:"line"`
Unresolved string `json:"unresolved,omitempty"`
}
type DatasetColumn ¶
type DatasetColumn = engine.DatasetColumn
DatasetColumn is one column in a host-declared raw-source contract.
type DatasetListRequest ¶
type DatasetListRequest struct {
Dataset string
Relation string
Key []string
Columns []DatasetColumn
Select []string
Filter *ObjectFilter
Sort []ObjectSort
Limit int
Offset int
IncludeTotal bool
Dialect string
RelationBindings map[string]string `json:"-"`
}
DatasetListRequest is a bounded inspection query over a closed dataset contract. Dataset, Relation, Key, and Columns are trusted host structure; Select, Filter, Sort, Limit, and Offset may originate with a caller.
type DatasetQueryPlan ¶
type DatasetQueryPlan struct {
Version string `json:"version"`
Dataset string `json:"dataset"`
ModelHash string `json:"model_hash"`
Fingerprint string `json:"fingerprint"`
Dependencies []string `json:"dependencies"`
Columns []ObjectColumn `json:"columns"`
Rows SQLPlan `json:"rows"`
Count *SQLPlan `json:"count,omitempty"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
DatasetQueryPlan is ready for execution by a host-owned transaction.
type DecodedObjectRow ¶
type DecodedResult ¶
type DecodedResult struct {
ObjectType string `json:"object_type"`
Rows []DecodedObjectRow `json:"rows"`
HasMore bool `json:"has_more"`
}
type DerivedRelationPlan ¶
type DerivedRelationPlan struct {
Version string `json:"version"`
Relation string `json:"relation"`
ModelHash string `json:"model_hash"`
Fingerprint string `json:"fingerprint"`
Dependencies []string `json:"dependencies"`
Query SQLPlan `json:"query"`
}
DerivedRelationPlan is immutable SQL ready for a host-owned transaction. Dependencies retain logical model identities; Query contains the physical placement supplied for this compilation.
type DerivedRelationRequest ¶
type DerivedRelationRequest struct {
Relation string
Query string
AvailableRelations []string
Dialect string
File string
RelationBindings map[string]string `json:"-"`
}
DerivedRelationRequest asks Requel to validate and compile one trusted, host-authored read-only relation. AvailableRelations is the complete logical namespace the host permits this query to read.
type Diagnostic ¶
type Diagnostic = engine.Diagnostic
Diagnostic is one stable, source-anchored compiler finding.
type Diagnostics ¶
type Diagnostics []*Diagnostic
Diagnostics is a deterministic collection of compiler findings.
type Filterable ¶
type FunctionColumnLabel ¶ added in v0.3.0
type FunctionColumnLabel = functionruntime.ColumnLabel
type FunctionColumnType ¶ added in v0.3.0
type FunctionColumnType = functionruntime.ColumnType
FunctionColumnType is the closed scalar type vocabulary accepted at a function terminal boundary.
type FunctionContract ¶ added in v0.3.0
type FunctionContract struct {
Entrypoint string `json:"entrypoint"`
ResultKind string `json:"result_kind"`
Cardinality string `json:"cardinality"`
Doc string `json:"doc,omitempty"`
DefinitionFingerprint string `json:"definition_fingerprint"`
PlanFingerprint string `json:"plan_fingerprint"`
Targets []string `json:"targets"`
DataFlows []FunctionDataFlow `json:"data_flows"`
Reads []TerminalRead `json:"reads"`
OutputSchema FunctionSchema `json:"output_schema"`
MaxRows int `json:"max_rows"`
}
FunctionContract is the stable, detached description an embedding host needs to authorize and prepare a function run. It contains no executable DAG.
type FunctionDataFlow ¶ added in v0.3.0
type FunctionError ¶ added in v0.3.0
type FunctionError = functionruntime.Error
type FunctionExecution ¶ added in v0.3.0
type FunctionExecution struct {
AllowedTargets map[string]bool
AllowedFlows map[string]bool
MaxRows int
Terminal FunctionTerminalExecutor
Now func() time.Time
NewID func(prefix string) string
OnStep func(FunctionTerminalCall, FunctionStepRun, *FunctionTable, error)
}
type FunctionIncompleteReason ¶ added in v0.3.0
type FunctionIncompleteReason = functionruntime.IncompleteReason
type FunctionOrder ¶ added in v0.3.0
type FunctionOrder = functionruntime.Order
type FunctionProvenance ¶ added in v0.3.0
type FunctionProvenance = functionruntime.StepProvenance
type FunctionResultColumn ¶ added in v0.3.0
type FunctionResultColumn = functionruntime.ResultColumn
type FunctionRun ¶ added in v0.3.0
type FunctionRun = functionruntime.Run
type FunctionSchema ¶ added in v0.3.0
type FunctionSchema = functionruntime.Schema
type FunctionStepRun ¶ added in v0.3.0
type FunctionStepRun = functionruntime.StepRun
type FunctionTable ¶ added in v0.3.0
type FunctionTable = functionruntime.Table
type FunctionTerminalCall ¶ added in v0.3.0
type FunctionTerminalCall struct {
Node string `json:"node"`
Target string `json:"target"`
Entrypoint string `json:"entrypoint"`
Security string `json:"security"`
Reads []TerminalRead `json:"reads"`
Schema FunctionSchema `json:"schema"`
MaxRows int `json:"max_rows"`
Params map[string]any `json:"params"`
}
FunctionTerminalCall is the complete contract for one host-executed leaf. The host receives logical addresses and typed parameters, never the function DAG itself.
type FunctionTerminalExecutor ¶ added in v0.3.0
type FunctionTerminalExecutor func(context.Context, FunctionTerminalCall) (*FunctionTerminalResult, error)
type FunctionTerminalResult ¶ added in v0.3.0
type FunctionTerminalResult struct {
Table *FunctionTable
Evidence map[string]any
}
type Graph ¶
type Graph struct {
Objects []GraphObject `json:"objects"`
Edges []GraphEdge `json:"edges"`
ComposedEdges []ComposedEdge `json:"composed_edges"`
Pairs []GraphPair `json:"pairs"`
UnboundEdges []UnboundEdge `json:"unbound_edges"`
Unresolved []UnresolvedBinding `json:"unresolved_bindings"`
MaxDepth int `json:"max_depth"`
Truncated bool `json:"truncated"`
}
Graph is the statically derived object and edge graph for one model.
type GraphEdge ¶
type GraphEdge struct {
From string `json:"from"`
Edge string `json:"edge"`
To string `json:"to"`
Cardinality string `json:"cardinality"`
Optional bool `json:"optional"`
Guarded bool `json:"guarded"`
Backing string `json:"backing,omitempty"`
Source string `json:"source"`
DeclFile string `json:"decl_file"`
DeclLine int `json:"decl_line"`
BindFile string `json:"bind_file,omitempty"`
BindLine int `json:"bind_line,omitempty"`
}
type GraphObject ¶
type HostModule ¶
type HostModule struct {
Namespace string
ABIVersion string
Exports starlark.StringDict
}
HostModule is the stable embedding boundary for trusted operational declarations. Model code imports it as host:<namespace>; exports never enter the global compiler scope. Requel evaluates declarations but never executes operational effects or owns their state.
type LoadOptions ¶
type LoadOptions struct {
HostModules []HostModule
// ActionVocabulary is the host capability catalog: the event kinds and
// outbound connection names the host's registries declare, injected at
// load so the emits/invokes halves of action effect envelopes validate
// beside the rest of the contract. Names only — URLs, credentials, SQL,
// and handler implementations never enter the model. nil leaves those
// members to the host's own validation.
ActionVocabulary *ActionVocabulary
}
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is an immutable semantic definition from the host's point of view. Reloading is explicit: construct a new Model and atomically replace the old one. Each compilation still uses a fresh hermetic Starlark evaluation.
func (*Model) ActionAllowed ¶ added in v0.3.0
func (m *Model) ActionAllowed(name string, ref ActionObjectRef, target, input map[string]any) (bool, error)
ActionAllowed evaluates the model's pure row eligibility predicate. The host must resolve and authorize ref before calling it; this method grants no capability and performs no lookup or mutation.
func (*Model) ActionAllowedFor ¶ added in v0.3.0
ActionAllowedFor evaluates optional semantic actor eligibility after the embedding host has independently granted the action capability.
func (*Model) ActionContract ¶ added in v0.3.0
func (m *Model) ActionContract(name string) (*ActionContract, bool)
ActionContract returns one compiled action declaration by exact case-sensitive name.
func (*Model) ActionContracts ¶ added in v0.3.0
func (m *Model) ActionContracts() []ActionContract
ActionContracts returns every compiled action declaration in deterministic name order.
func (*Model) ActionRequiresReview ¶ added in v0.3.0
func (m *Model) ActionRequiresReview(name string, ref ActionObjectRef, target, input map[string]any) (bool, error)
ActionRequiresReview evaluates the model's pure review predicate. A host may independently require review; the model result can never waive that platform policy.
func (*Model) Catalog ¶
Catalog returns a detached copy so callers cannot mutate the model's cached definition through slices or maps.
func (*Model) CatalogHash ¶
CatalogHash identifies the immutable catalog derived from the source.
func (*Model) Compile ¶
Compile evaluates, checks, and lowers one call. It performs no external I/O beyond reading the already selected ontology repository and never executes the returned plan.
func (*Model) CompileDatasetList ¶
func (m *Model) CompileDatasetList(ctx context.Context, request DatasetListRequest) (*DatasetQueryPlan, *Diagnostic)
CompileDatasetList compiles raw-source inspection through Requel's object predicate, ordering, identifier, bind, and lowering machinery. It never opens or executes against the declared relation.
func (*Model) CompileDerivedRelation ¶
func (m *Model) CompileDerivedRelation(ctx context.Context, request DerivedRelationRequest) (*DerivedRelationPlan, *Diagnostic)
CompileDerivedRelation owns read-only validation, deterministic-function validation, dependency discovery, and compile-local relation placement. It performs no I/O and never executes the returned statement.
func (*Model) CompileFunction ¶ added in v0.3.0
func (m *Model) CompileFunction(ctx context.Context, call Call) (*CompiledFunction, *Diagnostic)
CompileFunction compiles and independently verifies a function entrypoint, then returns the narrow read-only execution seam.
func (*Model) CompileObjectAggregate ¶
func (m *Model) CompileObjectAggregate(ctx context.Context, request ObjectAggregateRequest) (*ObjectAggregatePlan, *Diagnostic)
CompileObjectAggregate compiles a bounded aggregate over the same effective object source used by list, get, and traversal.
func (*Model) CompileObjectGet ¶
func (m *Model) CompileObjectGet(ctx context.Context, request ObjectGetRequest) (*ObjectQueryPlan, *Diagnostic)
CompileObjectGet compiles an exact typed-key lookup with a two-row bound so the host can distinguish not-found, one row, and a violated key contract.
func (*Model) CompileObjectKeyProbe ¶
func (m *Model) CompileObjectKeyProbe(ctx context.Context, request ObjectKeyProbeRequest) (*ObjectKeyProbePlan, *Diagnostic)
CompileObjectKeyProbe compiles a bounded duplicate-key integrity check over the same authorized, decorated effective relation as normal object reads.
func (*Model) CompileObjectList ¶
func (m *Model) CompileObjectList(ctx context.Context, request ObjectListRequest) (*ObjectQueryPlan, *Diagnostic)
CompileObjectList compiles a generic object page without opening a database.
func (*Model) CompileObjectTraversal ¶
func (m *Model) CompileObjectTraversal(ctx context.Context, request ObjectTraversalRequest) (*ObjectQueryPlan, *Diagnostic)
CompileObjectTraversal compiles a governed traversal as a single SQL plan. It neither reads the source row first nor infers paths between object types.
func (*Model) DeploymentHash ¶
DeploymentHash identifies the compiler and standard-library semantics.
func (*Model) EvaluateOperationalModules ¶
func (m *Model) EvaluateOperationalModules(ctx context.Context, paths []string) *Diagnostic
EvaluateOperationalModules evaluates trusted .star declarations in one Requel loader session. They may load .rql object modules and host modules, but receive no filesystem, database, network, clock, or compiler handle.
func (*Model) Inspect ¶
func (m *Model) Inspect(entrypoint string) (map[string]any, *Diagnostic)
Inspect returns the typed callable contract of one entrypoint.
func (*Model) MaxRows ¶ added in v0.3.0
MaxRows is the repository-wide authored ceiling for result-bearing query assets. Embedding hosts enforce it while consuming driver rows, before a decoder or function runtime can retain an oversized result.
func (*Model) Object ¶
func (m *Model) Object(name string) (*ObjectType, bool)
Object returns one nominal object contract by exact case-sensitive name.
func (*Model) Objects ¶
func (m *Model) Objects() []ObjectType
Objects returns every nominal object contract in deterministic name order.
func (*Model) RenderAction ¶ added in v0.3.0
func (m *Model) RenderAction(name string, ref ActionObjectRef, target, input map[string]any) ([]ActionEffect, error)
RenderAction evaluates the authored pure effects function and returns a closed execution-neutral intent list after enforcing the declaration's default-deny envelope. Requel has no API capable of applying the result.
func (*Model) Root ¶
Root returns the source directory used by Load. Models created with LoadModel are filesystem-free and return an empty string.
func (*Model) SourceHash ¶
SourceHash identifies the normalized model inputs. Tiny's model_hash is exactly this value.
type ObjectAggregateMeasure ¶
type ObjectAggregatePlan ¶
type ObjectAggregatePlan struct {
Version string `json:"version"`
ObjectType string `json:"object_type"`
ModelHash string `json:"model_hash"`
Fingerprint string `json:"fingerprint"`
Dependencies []string `json:"dependencies"`
DependencyCoverage string `json:"dependency_coverage"`
Columns []ObjectColumn `json:"columns"`
Rows SQLPlan `json:"rows"`
SourceAccesses []SourceAccess `json:"source_accesses"`
}
func (*ObjectAggregatePlan) Decode ¶
func (p *ObjectAggregatePlan) Decode(rows []CanonicalRow) ([]map[string]any, *Diagnostic)
Decode validates an aggregate result against its generated scalar schema. Aggregate rows are ordinary typed result rows, never object instances.
type ObjectAggregateRequest ¶
type ObjectAggregateRequest struct {
ObjectType string
Filter *ObjectFilter
GroupBy []string
Measures []ObjectAggregateMeasure
Limit int
Principal Principal
Now time.Time
Dialect string
Options CompileOptions
}
type ObjectColumn ¶
type ObjectColumn = engine.ObjectColumn
type ObjectDisplay ¶
type ObjectExprOp ¶
type ObjectExprOp = engine.ObjectExprOp
type ObjectFilter ¶
type ObjectFilter = engine.ObjectFilter
type ObjectGetRequest ¶
type ObjectKeyProbePlan ¶
type ObjectKeyProbePlan struct {
Version string `json:"version"`
ObjectType string `json:"object_type"`
Key []string `json:"key"`
ModelHash string `json:"model_hash"`
Fingerprint string `json:"fingerprint"`
Dependencies []string `json:"dependencies"`
DependencyCoverage string `json:"dependency_coverage"`
Rows SQLPlan `json:"rows"`
}
type ObjectKeyProbeRequest ¶
type ObjectLink ¶
type ObjectListRequest ¶
type ObjectListRequest struct {
ObjectType string
Select []string
Filter *ObjectFilter
Sort []ObjectSort
Limit int
Offset int
IncludeTotal bool
Principal Principal
Now time.Time
Dialect string
Options CompileOptions
}
ObjectListRequest is a generic governed read over one nominal object type.
type ObjectQueryPlan ¶
type ObjectQueryPlan struct {
Version string `json:"version"`
ObjectType string `json:"object_type"`
SchemaHash string `json:"schema_hash"`
ModelHash string `json:"model_hash"`
Fingerprint string `json:"fingerprint"`
Dependencies []string `json:"dependencies"`
DependencyCoverage string `json:"dependency_coverage"`
Columns []ObjectColumn `json:"columns"`
Rows SQLPlan `json:"rows"`
Count *SQLPlan `json:"count,omitempty"`
Limit int `json:"limit"`
Offset int `json:"offset"`
Cardinality ResultCardinality `json:"cardinality"`
SourceAccesses []SourceAccess `json:"source_accesses"`
}
ObjectQueryPlan contains the page and matching count statements compiled from one normalized request. Hosts execute both in one repeatable-read transaction.
func (*ObjectQueryPlan) Decode ¶
func (p *ObjectQueryPlan) Decode(rows []CanonicalRow) (DecodedResult, *Diagnostic)
Decode validates a driver-independent result against the exact compiled contract and constructs nominally typed object rows. It is deterministic and performs no I/O.
type ObjectSort ¶
type ObjectSort = engine.ObjectSort
type ObjectTraversalRequest ¶
type ObjectTraversalRequest struct {
SourceType string
SourceKey string
Edge string
Select []string
Filter *ObjectFilter
Sort []ObjectSort
Limit int
Offset int
IncludeTotal bool
Principal Principal
Now time.Time
Dialect string
Options CompileOptions
}
ObjectTraversalRequest follows one named direct or composed ontology edge from one exact source object. Edge names are model-authored capabilities; callers cannot submit arbitrary object pairs or join predicates.
type ObjectType ¶
type ObjectType struct {
Name string `json:"name"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Group string `json:"group,omitempty"`
Backing string `json:"backing"`
IsDerived bool `json:"is_derived"`
Dependencies []string `json:"dependencies"`
DependencyCoverage string `json:"dependency_coverage"`
SchemaHash string `json:"schema_hash"`
Key []string `json:"key"`
Display ObjectDisplay `json:"display"`
Properties []Property `json:"properties"`
Links []ObjectLink `json:"links"`
Dimensions []Dimension `json:"dimensions"`
Metrics []Metric `json:"metrics"`
Filterables []Filterable `json:"filterables"`
File string `json:"file"`
Line int `json:"line"`
}
ObjectType is one nominal object type and its closed instance contract.
type ObjectTypeValue ¶
type ObjectTypeValue = engine.ObjectTypeValue
ObjectTypeValue is the immutable nominal Starlark value returned by object.make and accepted by trusted host declarations.
type Plan ¶
type Plan struct {
Version string `json:"version"`
Kind PlanKind `json:"kind"`
Entrypoint string `json:"entrypoint"`
ModelHash string `json:"model_hash"`
Fingerprint string `json:"fingerprint"`
SQL *SQLPlan `json:"sql,omitempty"`
Retrieval json.RawMessage `json:"retrieval,omitempty"`
Function json.RawMessage `json:"function,omitempty"`
Relations []string `json:"relations"`
Guards []Guard `json:"guards"`
Warnings []Warning `json:"warnings"`
ResultSchema json.RawMessage `json:"result_schema,omitempty"`
SourceAccesses []SourceAccess `json:"source_accesses"`
}
Plan is the immutable output of compilation. SQL plans carry driver-ready text and arguments. Retrieval and function plans carry their canonical JSON wire documents so an embedding host does not depend on compiler internals.
func (*Plan) Decode ¶
func (p *Plan) Decode(rows []CanonicalRow) ([]map[string]any, *Diagnostic)
Decode validates ordinary authored-entrypoint rows. It never tags them as objects; nominal identity is reserved for generated object plans.
func (*Plan) ResultColumns ¶
func (p *Plan) ResultColumns() ([]ObjectColumn, *Diagnostic)
ResultColumns returns the detached, closed scalar contract for an authored entrypoint. It lets a host adapt driver values without learning semantic validation rules.
type PlanKind ¶
type PlanKind string
PlanKind identifies the external executor a compiled plan needs.
type Predicate ¶ added in v0.3.0
type Predicate = functionruntime.Predicate
type PredicateOperand ¶ added in v0.3.0
type PredicateOperand = functionruntime.Operand
type Principal ¶
type Principal struct {
Subject string `json:"subject,omitempty"`
Roles []string `json:"roles,omitempty"`
Attrs map[string]any `json:"attrs,omitempty"`
}
Principal is trusted context supplied by the embedding host. It is separate from Call.Params because callers may choose parameters but must never choose their own identity, roles, tenancy attributes, or clock.
type Property ¶
type Property struct {
Name string `json:"name"`
Type string `json:"type"`
IsKey bool `json:"is_key"`
IsNullable bool `json:"is_nullable"`
IsWritable bool `json:"is_writable"`
IsComputed bool `json:"is_computed"`
MaskRole string `json:"mask_role,omitempty"`
Doc string `json:"doc,omitempty"`
Label string `json:"label,omitempty"`
Labels []string `json:"labels,omitempty"`
Format string `json:"format,omitempty"`
}
func (Property) Decode ¶
func (p Property) Decode(cell CanonicalCell) (any, *Diagnostic)
Decode validates one canonical value against this property's complete scalar, nullability, label, and format contract.
type ResultCardinality ¶
type ResultCardinality string
const ( CardinalityPage ResultCardinality = "page" CardinalityAtMostOneObject ResultCardinality = "at_most_one_object" )
type SQLPlan ¶
type SQLPlan struct {
Dialect string `json:"dialect"`
Text string `json:"text"`
Args []any `json:"args"`
Binds []Bind `json:"binds"`
}
SQLPlan is ready for a host-owned database transaction.
type SourceAccess ¶ added in v0.3.0
type SourceAccess = engine.SourceAccess
type SourceDecorationRequest ¶
type SourceDecorationRequest struct {
Object ObjectType
Alias string
Authorized SourcePlan
}
type SourceDecorator ¶
type SourceDecorator interface {
DecorateObjectSource(SourceDecorationRequest) (SourceWrapper, *Diagnostic)
}
type SourcePlan ¶
type SourcePlan struct {
// contains filtered or unexported fields
}
SourcePlan is an opaque authorized object source. A trusted decorator may wrap it, but cannot inspect, construct, replace, duplicate, or omit it.
type SourceWrapper ¶
SourceWrapper is the stable trusted-host authorization seam. The compiler inserts Authorized exactly once between Before and After. Each {{bind}} marker consumes one typed Bind in order.
type TerminalRead ¶ added in v0.3.0
type TerminalRead = functionruntime.TerminalRead
type UnboundEdge ¶
type UnresolvedBinding ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
connectors
module
|
|
|
Package devkit contains source-authoring operations built on the Requel compiler.
|
Package devkit contains source-authoring operations built on the Requel compiler. |
|
examples
|
|
|
embed
command
Command embed is the smallest complete Requel host.
|
Command embed is the smallest complete Requel host. |
|
internal
|
|
|
ast
Package ast defines the abstract syntax tree for the `sql"…"` fragment surface.
|
Package ast defines the abstract syntax tree for the `sql"…"` fragment surface. |
|
audit
Package audit builds warehouse-side attribution for executed queries (backlog item 6).
|
Package audit builds warehouse-side attribution for executed queries (backlog item 6). |
|
buildinfo
Package buildinfo owns process build metadata shared by the compiler's diagnostics and the standalone runtime.
|
Package buildinfo owns process build metadata shared by the compiler's diagnostics and the standalone runtime. |
|
compiler
Package rql implements RQL — a Starlark-hosted, governed SQL renderer — and the engine behind the `requel` CLI.
|
Package rql implements RQL — a Starlark-hosted, governed SQL renderer — and the engine behind the `requel` CLI. |
|
correlation
Package correlation mints the opaque identifiers that tie one unit of work together across the two records the runtime keeps of it: the accountable audit trail and the operational telemetry.
|
Package correlation mints the opaque identifiers that tie one unit of work together across the two records the runtime keeps of it: the accountable audit trail and the operational telemetry. |
|
ctxsign
Package ctxsign verifies the signed context tokens of blueprint 02 §5.2.
|
Package ctxsign verifies the signed context tokens of blueprint 02 §5.2. |
|
diag
Package diag defines the stable diagnostic model: codes, severities, spans, and both human and JSON rendering.
|
Package diag defines the stable diagnostic model: codes, severities, spans, and both human and JSON rendering. |
|
function
Package function defines and executes RQL's target-neutral, read-only evidence function plan.
|
Package function defines and executes RQL's target-neutral, read-only evidence function plan. |
|
functioncheck
Package functioncheck is an intentionally independent verifier for canonical rql.function.v1 documents.
|
Package functioncheck is an intentionally independent verifier for canonical rql.function.v1 documents. |
|
lexer
Package lexer tokenizes the `sql"…"` fragment surface.
|
Package lexer tokenizes the `sql"…"` fragment surface. |
|
manifest
Package manifest holds the shared shape of requel.toml (blueprint 09 §2) — the connector/driver taxonomy and the [observability] validation that the connector layer and the RQL runtime both consult.
|
Package manifest holds the shared shape of requel.toml (blueprint 09 §2) — the connector/driver taxonomy and the [observability] validation that the connector layer and the RQL runtime both consult. |
|
personas
Package personas parses the persona file that `requel explain --personas` and `requel explain --personas` accept.
|
Package personas parses the persona file that `requel explain --personas` and `requel explain --personas` accept. |
|
render
Package render lowers a final Fragment to SQL text plus a bind list, in bind or inline mode, with dialect-specific placeholders and literals (blueprint 01 §6.3, 04 §5).
|
Package render lowers a final Fragment to SQL text plus a bind list, in bind or inline mode, with dialect-specific placeholders and literals (blueprint 01 §6.3, 04 §5). |
|
retrievalcheck
Package retrievalcheck is the retrieval target's independent oracle (blueprint 16 §9): a second derivation of the query body from the same pre-lowering inputs, sharing no code with the engine's lowering.
|
Package retrievalcheck is the retrieval target's independent oracle (blueprint 16 §9): a second derivation of the query body from the same pre-lowering inputs, sharing no code with the engine's lowering. |
|
value
Package value defines the runtime values shared by the render layer, including the Fragment type that carries SQL parts, bind values, and analysis metadata (blueprint 01, 03 §1).
|
Package value defines the runtime values shared by the render layer, including the Fragment type that carries SQL parts, bind values, and analysis metadata (blueprint 01, 03 §1). |