Skip to main content

icydb_core/model/
field.rs

1///
2/// EntityFieldModel
3///
4/// Runtime field metadata surfaced by macro-generated `EntityModel` values.
5///
6/// This is the smallest unit consumed by predicate validation, planning,
7/// and executor-side plan checks.
8///
9
10pub struct EntityFieldModel {
11    /// Field name as used in predicates and indexing.
12    pub name: &'static str,
13    /// Runtime type shape (no schema-layer graph nodes).
14    pub kind: EntityFieldKind,
15}
16
17///
18/// EntityFieldKind
19///
20/// Minimal runtime type surface needed by planning, validation, and execution.
21///
22/// This is aligned with `Value` variants and intentionally lossy: it encodes
23/// only the shape required for predicate compatibility and index planning.
24
25pub enum EntityFieldKind {
26    // Scalar primitives
27    Account,
28    Blob,
29    Bool,
30    Date,
31    Decimal,
32    Duration,
33    Enum,
34    E8s,
35    E18s,
36    Float32,
37    Float64,
38    Int,
39    Int128,
40    IntBig,
41    Principal,
42    Subaccount,
43    Text,
44    Timestamp,
45    Uint,
46    Uint128,
47    UintBig,
48    Ulid,
49    Unit,
50
51    // Collections
52    List(&'static Self),
53    Set(&'static Self),
54    Map {
55        key: &'static Self,
56        value: &'static Self,
57    },
58
59    /// Marker for fields that are not filterable or indexable.
60    Unsupported,
61}