lode/types/primitive

Primitive Ecto types: integer, float, boolean, string, binary, and the id/binary_id aliases. Each is an LodeType value you reference when declaring schema fields.

Types

A value that may be SQL NULL. (Distinct from gleam/option.Option so the null semantics stay explicit at the type boundary.)

pub type NullableValue(a) {
  Present(a)
  Absent
}

Constructors

  • Present(a)
  • Absent

Values

pub fn binary() -> type_.LodeType(BitArray)

Raw bytes (:binary).

pub fn boolean() -> type_.LodeType(Bool)

Boolean (:boolean). Casts true/false plus the usual textual forms.

pub fn float_type() -> type_.LodeType(Float)

Floating point (:float). Casts floats and integers (widened).

pub fn id() -> type_.LodeType(Int)

Surrogate primary key (:id). Same representation as integer.

pub fn integer() -> type_.LodeType(Int)

Signed integer (:integer). Casts integers and integer-shaped strings.

pub fn nullable(
  inner: type_.LodeType(a),
) -> type_.LodeType(NullableValue(a))

Make any type nullable: VNull maps to Error(Nil) cast-wise but is handled at the changeset level. This helper wraps a type so its runtime value is an Option, with VNull <-> None.

pub fn string() -> type_.LodeType(String)

UTF-8 text (:string).

Search Document