lode/value
The dynamic boundary between typed Gleam data and the database.
Ecto uses raw Erlang term() at this boundary. We make the small set of
runtime-tagged values explicit so the schema/changeset/query layers can stay
generic while still talking to a stringly-typed driver (e.g. pog).
Types
A runtime-tagged database value. Every LodeType mediates between a concrete
Gleam type and this representation via cast/load/dump.
pub type Value {
VNull
VInt(Int)
VFloat(Float)
VBool(Bool)
VString(String)
VBinary(BitArray)
VList(List(Value))
VMap(List(#(String, Value)))
VDecimal(decimal.Decimal)
VDate(calendar.Date)
VTime(calendar.TimeOfDay)
VNaiveDatetime(date: calendar.Date, time: calendar.TimeOfDay)
VTimestamp(timestamp.Timestamp)
VInterval(months: Int, days: Int, microseconds: Int)
}
Constructors
-
VNull -
VInt(Int) -
VFloat(Float) -
VBool(Bool) -
VString(String) -
VBinary(BitArray) -
VList(List(Value)) -
VMap(List(#(String, Value)))JSON objects / embedded maps. Association-preserving order, string keys.
-
VDecimal(decimal.Decimal)Arbitrary-precision decimal (
:decimal). Backed bydee. -
VDate(calendar.Date)Calendar date with no time or zone (
:date). -
VTime(calendar.TimeOfDay)Time of day with no date or zone (
:time). -
VNaiveDatetime(date: calendar.Date, time: calendar.TimeOfDay)Date + time with no zone (
:naive_datetime). -
VTimestamp(timestamp.Timestamp)An absolute instant (
:utc_datetime). -
VInterval(months: Int, days: Int, microseconds: Int)A Postgres
interval— months, days, and microseconds kept separate (Postgres never auto-normalizes across them).temporal.durationuses it.
Values
pub fn inspect(value: Value) -> String
A debug rendering of a value. Not SQL; for logs and test output only.