Decoding answers #
A RowDecoder α reads named columns of a concept row and builds an α. Decoders compose as an
applicative, and every decoder knows up front which columns it reads and which parts of each
concept it needs (its plan). The query layer hands the plan to the native batch call, which
returns exactly those concepts for many rows at once.
FromConcept says how one column becomes a Lean value. deriving FromRow (see
TypeDB.Deriving.FromRow) maps each structure field to the query variable of the same name.
Column flag, Lean side only: resolve the UTC offset of IANA-zoned datetimes.
Equations
Instances For
Equations
- TypeDB.instFromConceptString = TypeDB.FromConcept.ofValue "string" fun (x : TypeDB.Value) => match x with | TypeDB.Value.string s => some s | x => none
Equations
- TypeDB.instFromConceptBool = TypeDB.FromConcept.ofValue "boolean" fun (x : TypeDB.Value) => match x with | TypeDB.Value.bool b => some b | x => none
Equations
- TypeDB.instFromConceptInt64 = TypeDB.FromConcept.ofValue "integer" fun (x : TypeDB.Value) => match x with | TypeDB.Value.integer i => some i | x => none
Equations
- TypeDB.instFromConceptInt = TypeDB.FromConcept.ofValue "integer" fun (x : TypeDB.Value) => match x with | TypeDB.Value.integer i => some i.toInt | x => none
Rejects negative integers.
Equations
- One or more equations did not get rendered due to their size.
Equations
- TypeDB.instFromConceptFloat = TypeDB.FromConcept.ofValue "double" fun (x : TypeDB.Value) => match x with | TypeDB.Value.double d => some d | x => none
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- TypeDB.instFromConceptPlainDate = TypeDB.FromConcept.ofValue "date" fun (x : TypeDB.Value) => match x with | TypeDB.Value.date s => some (TypeDB.Time.plainDateOfSeconds s) | x => none
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
A Std.Time.DateTime at the value's offset; see DatetimeTZ.toDateTime.
Equations
- One or more equations did not get rendered due to their size.
Equations
- TypeDB.instFromConceptValue = { expected := "value", decode := fun (c : TypeDB.Concept) => match c.value? with | some v => Except.ok v | none => Except.error c.describe }
Equations
- One or more equations did not get rendered due to their size.
The whole concept, with its label and IID.
Equations
- TypeDB.instFromConceptConcept = { expected := "concept", flags := TypeDB.Native.wantLabel ||| TypeDB.Native.wantIID, decode := Except.ok }
Equations
- TypeDB.instReprLabel.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "name" ++ Std.Format.text " := " ++ (Std.Format.nest 8 (repr x✝.name)).group) " }"
Instances For
Equations
- TypeDB.instReprLabel = { reprPrec := TypeDB.instReprLabel.repr }
Equations
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Fails the decode of every row with err if ok is false.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Column names and per-column flags, as the native batch call takes them.
Equations
Instances For
The required column name.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The optional column name: none when the row leaves it empty (e.g. from a try).
Equations
- One or more equations did not get rendered due to their size.
Instances For
How a structure field reads its column; Option fields are optional.
- column : String → RowDecoder α
Instances
Equations
- TypeDB.instFromColumnOfFromConcept = { column := fun (n : String) => TypeDB.col n }
Equations
- TypeDB.instFromColumnOptionOfFromConcept = { column := fun (n : String) => TypeDB.colOpt n }
Types decoded from a whole row. Derive it for structures with deriving FromRow.
- decoder : RowDecoder α
Instances
A single named column.
- val : α
Instances For
Equations
- TypeDB.instReprCol = { reprPrec := TypeDB.instReprCol.repr }
Equations
- TypeDB.instReprCol.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "val" ++ Std.Format.text " := " ++ (Std.Format.nest 7 (repr x✝.val)).group) " }"
Instances For
Equations
- TypeDB.instInhabitedCol = { default := TypeDB.instInhabitedCol.default }
Equations
- TypeDB.instFromRowColOfFromConcept = { decoder := (fun (x : α) => { val := x }) <$> TypeDB.col name }
Equations
- TypeDB.instFromRowProd = { decoder := Prod.mk <$> TypeDB.FromRow.decoder <*> TypeDB.FromRow.decoder }