Skip to main content

icydb_model/base/types/
geo.rs

1//! Module: base::types::geo
2//!
3//! Responsibility: base domain type declarations.
4//! Does not own: runtime storage, query execution, or validator implementation internals.
5//! Boundary: declares macro-modeled domain wrappers and records for downstream schemas.
6
7use crate::prelude::*;
8
9///
10/// AddressLine
11///
12/// - Trim
13/// - Length: 1–100
14/// - Allowed characters are not enforced
15///
16
17#[newtype(
18    source_key = "crates/icydb/src/base/types/geo.rs::newtype::1",
19    primitive = "Text",
20    item(prim = "Text", unbounded),
21    ty(
22        normalizer(path = "base::normalizer::text::Trim"),
23        validator(path = "base::validator::len::Range", args(1, 100)),
24    )
25)]
26pub struct AddressLine {}
27
28///
29/// CityName
30///
31/// - Trim
32/// - TitleCase (optional, e.g. “new york” → “New York”)
33/// - Length: 1–100
34/// - Allowed: letters, spaces, apostrophes, hyphens
35///
36
37#[newtype(
38    source_key = "crates/icydb/src/base/types/geo.rs::newtype::2",
39    primitive = "Text",
40    item(prim = "Text", unbounded),
41    ty(
42        normalizer(path = "base::normalizer::text::Trim"),
43        normalizer(path = "base::normalizer::text::case::Title"),
44        validator(path = "base::validator::len::Range", args(1, 100)),
45    )
46)]
47pub struct CityName {}
48
49///
50/// PostalCode
51///
52/// - Trim whitespace
53/// - Uppercase
54/// - Length: 3–12 chars
55/// - Allowed characters are not enforced
56///
57
58#[newtype(
59    source_key = "crates/icydb/src/base/types/geo.rs::newtype::3",
60    primitive = "Text",
61    item(prim = "Text", unbounded),
62    ty(
63        normalizer(path = "base::normalizer::text::Trim"),
64        normalizer(path = "base::normalizer::text::case::Upper"),
65        validator(path = "base::validator::len::Range", args(3, 12)),
66    )
67)]
68pub struct PostalCode {}
69
70///
71/// RegionName
72/// (state/province)
73///
74/// - Trim
75/// - Uppercase
76/// - Length: 2–50
77/// - Allowed characters are not enforced
78///
79
80#[newtype(
81    source_key = "crates/icydb/src/base/types/geo.rs::newtype::4",
82    primitive = "Text",
83    item(prim = "Text", unbounded),
84    ty(
85        normalizer(path = "base::normalizer::text::Trim"),
86        normalizer(path = "base::normalizer::text::case::Upper"),
87        validator(path = "base::validator::len::Range", args(2, 50)),
88    )
89)]
90pub struct RegionName {}