lode/types/temporal

Temporal types: :date, :time, :naive_datetime, :utc_datetime.

Backed by gleam/time (calendar.Date, calendar.TimeOfDay, timestamp.Timestamp) so values compare and order correctly and round-trip natively through pog.

cast/load are lenient: they accept the native Value variant and the ISO-8601 string fallback (and, for :utc_datetime, an Int of Unix seconds). dump is canonical and always emits the native variant.

Values

pub fn date() -> type_.LodeType(calendar.Date)

:dateYYYY-MM-DD.

pub fn duration() -> type_.LodeType(duration.Duration)

interval / :duration — a span of time, backed by gleam/time/duration.

Round-trips a Postgres interval through the normal bound-parameter path: dump emits a VInterval the adapter binds via pgo’s interval encoder, and the adapter decodes a read into a VInterval that load folds into a Duration. A Duration is a fixed span, so on read the calendar parts collapse (days = 86400s, months = 30×86400s); on write everything is sent in the microseconds component (months = days = 0).

pub fn naive_datetime() -> type_.LodeType(
  #(calendar.Date, calendar.TimeOfDay),
)

:naive_datetimeYYYY-MM-DD HH:MM:SS with no offset.

pub fn time() -> type_.LodeType(calendar.TimeOfDay)

:timeHH:MM:SS[.ffffff].

pub fn utc_datetime() -> type_.LodeType(timestamp.Timestamp)

:utc_datetime — an absolute instant (RFC 3339 / ...Z).

Search Document