5.15 · Reference
Utilities¶
hinoki.utils.Clock ¶
Bases: Protocol
A callable clock; inject one when time-dependent behavior needs control.
hinoki.utils.utc_now ¶
utc_now() -> datetime
Return the current time as a timezone-aware UTC datetime.
hinoki.utils.utc_today ¶
utc_today(clock: Clock = utc_now) -> date
Return the UTC calendar date from an aware clock value.
hinoki.orm.timestamps ¶
timestamps(
updated_at: str = "updated_at",
*,
clock: Clock = utc_now,
) -> Callable[[M], M]
Update a declared datetime column on each ORM update statement.
Timestamp columns remain ordinary model fields, visible to type checkers
and migrations. Declare their creation defaults with utc_now.