Documentation
¶
Overview ¶
Package casts provides a small attribute-casting layer the ORM applies on reads and writes. Each cast maps SQL ↔ Go through a registered Cast. Built-in casts: json, bool, int, float, date, datetime.
Custom casts can be registered with Register() at init time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoolCast ¶
type BoolCast struct{}
BoolCast normalizes 0/1/"t"/"f"/"true"/"false" to bool.
type Cast ¶
Cast converts a value coming back from the DB (FromDB) and going to the DB (ToDB). Implementations should be allocation-conscious; they may be called many times per row.
type DateCast ¶
type DateCast struct{}
DateCast renders/parses values as YYYY-MM-DD.
type IntCast ¶
type IntCast struct{}
IntCast parses string/numeric into int64.
Click to show internal directories.
Click to hide internal directories.