Liking cljdoc? Tell your friends :D

datahike.pg.constraints.row

Shared PostgreSQL row preparation and immediate constraint phases.

prepare-candidate materializes INSERT defaults and enforces NOT NULL. validate-pre-arbiter! adds CHECK/domain validation before ON CONFLICT arbitration. validate-mutation! validates an actual INSERT/UPDATE result and therefore also enforces foreign keys. Keeping those phases distinct mirrors PostgreSQL's ExecInsert/ExecOnConflictUpdate ordering.

Shared PostgreSQL row preparation and immediate constraint phases.

`prepare-candidate` materializes INSERT defaults and enforces NOT NULL.
`validate-pre-arbiter!` adds CHECK/domain validation before ON CONFLICT
arbitration. `validate-mutation!` validates an actual INSERT/UPDATE result
and therefore also enforces foreign keys.  Keeping those phases distinct
mirrors PostgreSQL's ExecInsert/ExecOnConflictUpdate ordering.
raw docstring

column-specsclj

(column-specs db table-name)
source

compile-constraint-metadataclj

(compile-constraint-metadata {:keys [checks fks domain-enum] :as metadata})

Compile a previously read metadata snapshot. Does not reread its database or evaluate defaults/predicates. Check ordering follows the input snapshot.

Compile a previously read metadata snapshot. Does not reread its database
or evaluate defaults/predicates. Check ordering follows the input snapshot.
sourceraw docstring

constraint-metadataclj

(constraint-metadata db table-name)

Read per-table row-constraint inputs without parsing SQL expressions or evaluating defaults, predicates, or queries written in SQL. FK column JSON is decoded only to resolve the same physical attribute mappings as a plan. Retains raw definitions so changes can be compared before using a plan.

Read per-table row-constraint inputs without parsing SQL expressions or
evaluating defaults, predicates, or queries written in SQL. FK column JSON
is decoded only to resolve the same physical attribute mappings as a plan.
Retains raw definitions so changes can be compared before using a plan.
sourceraw docstring

constraint-planclj

(constraint-plan db table-name)

Compile per-table metadata once for a statement/tx function.

Compile per-table metadata once for a statement/tx function.
sourceraw docstring

eval-defaultclj

(eval-default kind value)
source

logical-rowclj

(logical-row table-name attrs columns)
source

plan-required?clj

(plan-required? plan explicit-nulls?)

True when an INSERT needs the row-constraint transaction function.

A table's ordinary column list alone is not a reason to wrap every row. The wrapper is needed only for defaults/NOT NULL, row constraints, or to erase an explicit SQL NULL before handing the entity map to Datahike.

True when an INSERT needs the row-constraint transaction function.

A table's ordinary column list alone is not a reason to wrap every row.
The wrapper is needed only for defaults/NOT NULL, row constraints, or to
erase an explicit SQL NULL before handing the entity map to Datahike.
sourceraw docstring

prepare-candidateclj

(prepare-candidate attrs plan coerce-fn)

Materialize omitted defaults and reject NULL in NOT NULL columns. coerce-fn receives [value attr]. Sequence defaults must already have been reserved through the live nextval service before row validation.

Materialize omitted defaults and reject NULL in NOT NULL columns.
`coerce-fn` receives [value attr]. Sequence defaults must already have
been reserved through the live nextval service before row validation.
sourceraw docstring

validate-mutation!clj

(validate-mutation! db
                    table-name
                    attrs
                    plan
                    effective-rows
                    eval-check-fn
                    validate-domain-fn)

Validate an actual INSERT/UPDATE result. Unlike a speculative candidate, this phase includes FK enforcement and never applies INSERT defaults.

Validate an actual INSERT/UPDATE result. Unlike a speculative candidate,
this phase includes FK enforcement and never applies INSERT defaults.
sourceraw docstring

validate-pre-arbiter!clj

(validate-pre-arbiter! db
                       table-name
                       attrs
                       plan
                       eval-check-fn
                       validate-domain-fn)

Enforce constraints PostgreSQL checks before unique-index arbitration. eval-check-fn receives [AST logical-row table-name schema]. validate-domain-fn, when supplied, receives the storage row.

Enforce constraints PostgreSQL checks before unique-index arbitration.
`eval-check-fn` receives [AST logical-row table-name schema].
`validate-domain-fn`, when supplied, receives the storage row.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close