Documentation
¶
Overview ¶
Package bind validates frozen public mutations against the active immutable schema registry and converts them into provider-neutral mutation IR. It does no provider work and owns no SQL vocabulary.
Index ¶
- func BatchPredicate(frozen golem.FrozenPredicate, expectedModel golem.ModelID, ...) (policyir.Condition, error)
- func ExactStoredScalarValue(raw any, field schema.Field, registry *schema.Registry) (policyir.Value, error)
- func WithRuntimeOwnedOperations(model policyir.ModelID, kind InputKind, ...) ([]mutationir.ScalarOperation, error)
- type BoundTarget
- type Error
- type ErrorCode
- type InputKind
- type RuntimeOwnedValue
- type ScalarInput
- func CreateInput(frozen golem.FrozenMutationInput, registry *schema.Registry) (ScalarInput, error)
- func CreateInputFromHook(frozen golem.FrozenMutationInput, registry *schema.Registry, ...) (ScalarInput, []policyir.FieldID, error)
- func CreateInputWithRuntimeOwnedFields(frozen golem.FrozenMutationInput, registry *schema.Registry, ...) (ScalarInput, []policyir.FieldID, error)
- func UpdateInput(frozen golem.FrozenMutationInput, registry *schema.Registry) (ScalarInput, error)
- func UpdateInputFromHook(frozen golem.FrozenMutationInput, registry *schema.Registry, ...) (ScalarInput, error)
- func UpdateManyInput(frozen golem.FrozenMutationInput, registry *schema.Registry) (ScalarInput, error)
- func WithOptimisticConcurrencyCreate(input ScalarInput, registry *schema.Registry) (ScalarInput, error)
- func WithRuntimeOwnedValues(input ScalarInput, registry *schema.Registry, values []RuntimeOwnedValue) (ScalarInput, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchPredicate ¶
func BatchPredicate(frozen golem.FrozenPredicate, expectedModel golem.ModelID, registry *schema.Registry) (policyir.Condition, error)
BatchPredicate binds one top-level update-many/delete-many filter. It owns schema identity, exact value, and public exposure validation only; classification remains with the planner because that requires the resolved caller policy and concrete selecting action.
func ExactStoredScalarValue ¶
func ExactStoredScalarValue(raw any, field schema.Field, registry *schema.Registry) (policyir.Value, error)
ExactStoredScalarValue routes CDC adapter values through the same logical scalar binder used by mutations. It is intentionally not a provider decoder: adapters must supply Golem's exact public scalar types, never driver values.
func WithRuntimeOwnedOperations ¶
func WithRuntimeOwnedOperations(model policyir.ModelID, kind InputKind, operations []mutationir.ScalarOperation, registry *schema.Registry, values []RuntimeOwnedValue) ([]mutationir.ScalarOperation, error)
WithRuntimeOwnedOperations is the model-erased nested-planner boundary. The supplied operations must already have passed ordinary public binding; this function only reconstructs that immutable input long enough to apply the same runtime-ownership validation used by root mutations.
Types ¶
type BoundTarget ¶
type BoundTarget struct {
// contains filtered or unexported fields
}
BoundTarget retains both the closed mutation target facts and the exact already-bound selector predicate needed by the authorization planner. The planner must not reconstruct equality from untyped selector payloads.
func Target ¶
func Target(frozen golem.FrozenMutationTarget, expectedModel golem.ModelID, registry *schema.Registry) (BoundTarget, error)
Target binds one frozen unique target for the model owned by the operation. Selector values are emitted in the active identity's declared order even when predicate canonicalization has reordered equality leaves.
func (BoundTarget) SelectorPredicate ¶
func (target BoundTarget) SelectorPredicate() policyir.Condition
func (BoundTarget) Target ¶
func (target BoundTarget) Target() mutationir.Target
type Error ¶
type ErrorCode ¶
type ErrorCode string
ErrorCode is a stable mutation-binding failure category. Detail and Cause are trusted diagnostics; Error deliberately exposes no provider or SQL text.
const ( CodeInput ErrorCode = "P4_BIND_INPUT" CodeModel ErrorCode = "P4_BIND_MODEL" CodeField ErrorCode = "P4_BIND_FIELD" CodeExposure ErrorCode = "P4_BIND_EXPOSURE" CodeRequired ErrorCode = "P4_BIND_REQUIRED" CodeOperation ErrorCode = "P4_BIND_OPERATION" CodeValue ErrorCode = "P4_BIND_VALUE" CodeTarget ErrorCode = "P4_BIND_TARGET" CodeGuard ErrorCode = "P4_BIND_GUARD" CodeInternal ErrorCode = "P4_BIND_INTERNAL" )
type RuntimeOwnedValue ¶
type ScalarInput ¶
type ScalarInput struct {
// contains filtered or unexported fields
}
ScalarInput is the immutable root-scalar result of binding. Operations are sorted by stable field identity and copied at every collection boundary.
func CreateInput ¶
func CreateInput(frozen golem.FrozenMutationInput, registry *schema.Registry) (ScalarInput, error)
func CreateInputFromHook ¶ added in v0.3.2
func CreateInputWithRuntimeOwnedFields ¶
func CreateInputWithRuntimeOwnedFields(frozen golem.FrozenMutationInput, registry *schema.Registry, fields []golem.FieldID) (ScalarInput, []policyir.FieldID, error)
CreateInputWithRuntimeOwnedFields is the narrow nested-create boundary for correlation columns whose values are derived from a persisted parent row. Root creates must use CreateInput. Every exemption is revalidated against the active schema and returned as a closed, sorted inventory for the planner.
func UpdateInput ¶
func UpdateInput(frozen golem.FrozenMutationInput, registry *schema.Registry) (ScalarInput, error)
func UpdateInputFromHook ¶ added in v0.3.2
func UpdateInputFromHook(frozen golem.FrozenMutationInput, registry *schema.Registry, hookAuthored []golem.FieldID) (ScalarInput, error)
func UpdateManyInput ¶
func UpdateManyInput(frozen golem.FrozenMutationInput, registry *schema.Registry) (ScalarInput, error)
func WithOptimisticConcurrencyCreate ¶ added in v0.1.0
func WithOptimisticConcurrencyCreate(input ScalarInput, registry *schema.Registry) (ScalarInput, error)
WithOptimisticConcurrencyCreate installs the sole runtime-owned initial token for a concurrency-enabled model. Ordinary runtime defaults are not an authority for this field: its schema explicitly forbids a default/updated producer, and the fixed value 1 belongs only to this closed boundary.
func WithRuntimeOwnedValues ¶
func WithRuntimeOwnedValues(input ScalarInput, registry *schema.Registry, values []RuntimeOwnedValue) (ScalarInput, error)
WithRuntimeOwnedValues appends schema-authorized application defaults and updated-field values without turning them into caller-authored fields.
func (ScalarInput) Kind ¶
func (input ScalarInput) Kind() InputKind
func (ScalarInput) ModelID ¶
func (input ScalarInput) ModelID() policyir.ModelID
func (ScalarInput) Operations ¶
func (input ScalarInput) Operations() []mutationir.ScalarOperation