Xqlite.TypeExtension.Duration (Xqlite v0.8.0)

View Source

Encode-only type extension: exact-length Duration → int64 nanoseconds.

Only durations made of exact units convert — weeks, days, hours, minutes, seconds, microseconds. Calendar units (years, months) have no fixed length, so durations carrying them are skipped; binding then fails downstream with the NIF's structured rejection of the raw struct. There is deliberately no decode: a nanosecond span is indistinguishable from any other stored integer.

Mirrors XqliteEcto3.Types.Duration's semantics (int64 ns, exact-units-only). Requires Elixir 1.17+ — on older versions this module does not exist.