Skip to main content

icydb/base/types/
time.rs

1use crate::design::prelude::*;
2
3///
4/// CreatedAt
5///
6/// Creation timestamp wrapper.
7/// A zero value is sanitized to the current `Timestamp`.
8///
9
10#[newtype(
11    primitive = "Timestamp",
12    item(prim = "Timestamp"),
13    ty(sanitizer(path = "base::sanitizer::time::CreatedAt"))
14)]
15pub struct CreatedAt {}
16
17///
18/// UpdatedAt
19///
20/// Last-updated timestamp wrapper.
21/// Always sanitized to the current `Timestamp`.
22///
23
24#[newtype(
25    primitive = "Timestamp",
26    item(prim = "Timestamp"),
27    ty(sanitizer(path = "base::sanitizer::time::UpdatedAt"))
28)]
29pub struct UpdatedAt {}
30
31///
32/// Milliseconds
33///
34/// Duration wrapper expressed in milliseconds.
35///
36
37#[newtype(primitive = "Nat64", item(prim = "Nat64"))]
38pub struct Milliseconds {}
39
40///
41/// Seconds
42///
43/// Duration wrapper expressed in seconds.
44///
45
46#[newtype(primitive = "Nat64", item(prim = "Nat64"))]
47pub struct Seconds {}
48
49///
50/// Minutes
51///
52/// Duration wrapper expressed in minutes.
53///
54
55#[newtype(primitive = "Nat64", item(prim = "Nat64"))]
56pub struct Minutes {}