Documentation
¶
Overview ¶
Package decode owns immutable, closed persisted-row images for P4 mutations. Provider-specific scanning remains in the P3 read decoder; this package consumes its exact policy values and validates them against the one active schema registry.
Index ¶
- func AuthoredFields(registry *schema.Registry, before, after Row, authored []policyir.FieldID) ([]policyir.FieldID, error)
- func ChangedFields(before, after Row) ([]policyir.FieldID, error)
- func EqualCell(left, right Cell) bool
- func EqualRow(left, right Row) bool
- func EqualValue(left, right policyir.Value) bool
- func ValidateIdentity(registry *schema.Registry, model policyir.ModelID, identity Identity) error
- type Cell
- type Error
- type Identity
- func ExtractIdentity(registry *schema.Registry, row Row, key golem.KeyID) (Identity, error)
- func ExtractOrderedIdentity(registry *schema.Registry, row Row, fields []policyir.FieldID) (Identity, error)
- func NewIdentity(key golem.KeyID, components []IdentityComponent) (Identity, error)
- func PrimaryIdentity(registry *schema.Registry, row Row) (Identity, error)
- type IdentityComponent
- type IdentityTransition
- type Row
- func (row Row) Cell(field policyir.FieldID) (Cell, bool)
- func (row Row) Cells() []Cell
- func (row Row) IsComplete(registry *schema.Registry) (bool, error)
- func (row Row) ModelID() policyir.ModelID
- func (row Row) RequireFields(fields []policyir.FieldID) error
- func (row Row) Select(registry *schema.Registry, fields []policyir.FieldID) (Row, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthoredFields ¶
func AuthoredFields(registry *schema.Registry, before, after Row, authored []policyir.FieldID) ([]policyir.FieldID, error)
AuthoredFields intersects the exact persisted diff with the explicit input inventory. Database-generated, database/read-only, contract read-only, and runtime-updated fields can never be reported as caller-authored changes.
func ChangedFields ¶
ChangedFields returns the exact persisted before/after diff, including database-owned changes. Results are sorted by stable field identity.
func EqualValue ¶
EqualValue is exact logical equality. It deliberately compares floating point bits, byte content, normalized Decimal values, and canonical JSON/list structure without any interface or float64 JSON conversion.
Types ¶
type Cell ¶
type Cell struct {
// contains filtered or unexported fields
}
Cell is one exact persisted scalar. A null cell has no policy value.
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
Identity preserves key-declared component order. It supports scalar and composite primary/unique identities without reducing values to strings.
func ExtractIdentity ¶
func ExtractOrderedIdentity ¶
func ExtractOrderedIdentity(registry *schema.Registry, row Row, fields []policyir.FieldID) (Identity, error)
ExtractOrderedIdentity resolves the exact key whose declared component order matches a FactRequirement identity inventory, then extracts only those components from a possibly partial row.
func NewIdentity ¶
func NewIdentity(key golem.KeyID, components []IdentityComponent) (Identity, error)
func (Identity) Components ¶
func (identity Identity) Components() []IdentityComponent
type IdentityComponent ¶
type IdentityComponent struct {
// contains filtered or unexported fields
}
func IdentityNull ¶
func IdentityNull(field policyir.FieldID) (IdentityComponent, error)
func IdentityValue ¶
func (IdentityComponent) FieldID ¶
func (component IdentityComponent) FieldID() policyir.FieldID
func (IdentityComponent) IsNull ¶
func (component IdentityComponent) IsNull() bool
func (IdentityComponent) PolicyValue ¶
func (component IdentityComponent) PolicyValue() (policyir.Value, bool)
type IdentityTransition ¶
type IdentityTransition struct {
// contains filtered or unexported fields
}
func PrimaryIdentityTransition ¶
func PrimaryIdentityTransition(registry *schema.Registry, before, after *Row) (IdentityTransition, error)
PrimaryIdentityTransition retains both sides of an identity-changing update. Exactly one side may be nil for create/delete.
func (IdentityTransition) After ¶
func (transition IdentityTransition) After() (Identity, bool)
func (IdentityTransition) Before ¶
func (transition IdentityTransition) Before() (Identity, bool)
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row is a closed persisted scalar image sorted by stable field identity. It may be partial: the owning ImageRequirements define which fields an operation must project. Relation handles never belong to a row image.
func FromReadCells ¶
func FromReadCells(registry *schema.Registry, model policyir.ModelID, cells []readdecode.Cell) (Row, error)
FromReadCells is the intended runtime seam. SQL RETURNING or a locked row is projected through the ordinary P3 decoder, then frozen here as a complete P4 image. Completeness is defined by the caller's ImageRequirements. No provider return type is interpreted in this package.
func NewCompleteRow ¶
NewCompleteRow is the opt-in diagnostic boundary for callers that truly require every persisted scalar field, such as bounded batch capture.
func NewRow ¶
NewRow validates a closed provider-decoded persisted image. Values are normalized only at the declared temporal precision; every other logical value stays exact.
func (Row) RequireFields ¶
RequireFields proves that an operation's explicit field inventory is present in this partial image. Extra fields are allowed because a single SQL image may satisfy several authorization/hook/result requirements.