gizmodel/insert
the INSERT of a stored Model.Shape's records, as the tree every engine runs. A typed store (model/data.giz) and a SQL store's copy (model/store.giz) build it here; model/query.giz gives its names again.
import * as Insert from "gizmodel/insert";Types
Existing
type Existing = | { kind: "refuse"; } | { kind: "keep"; } | { kind: "replace"; } | { kind: "add"; }What an INSERT does with a row whose key is there already: refuse it (a conflict), keep the stored row, replace it, or add it: each numeric field holds the sum of the stored and the new value, each other field the new value.
refusekeepreplaceadd
Insertion
type Insertion = { statement: Tree.Statement; params: Vec<Value>; }An INSERT and the values of its parameters $1.., row by row in field order.
statement:M151.Statementparams:Vec<M143.Value>
Functions
insertion
function insertion(shape: Model.Shape, rows: Vec<Vec<Value>>, existing: Existing): Insertion throws DbErrorThe INSERT of ROWS of SHAPE (each one value per field, in field order; a computed field's is left out), which does EXISTING with a row whose key is there.
Effects: fail, alloc.
loading
function loading(shape: Model.Shape, load: Batch, existing: Existing): Tree.Statement throws DbErrorThe INSERT of the records in LOAD (Model.loadOf: a column for each stored field) into SHAPE's table, for an engine:
it stores the columns as they are. EXISTING is as insertion takes it.
Effects: fail, alloc.