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    primitive = "Text",
19    item(prim = "Text", unbounded),
20    ty(
21        normalizer(path = "base::normalizer::text::Trim"),
22        rule(name = "length", kind = "length_range_inclusive", args(1, 100)),
23    )
24)]
25pub struct AddressLine {}
26
27///
28/// CityName
29///
30/// - Trim
31/// - TitleCase (optional, e.g. “new york” → “New York”)
32/// - Length: 1–100
33/// - Allowed: letters, spaces, apostrophes, hyphens
34///
35
36#[newtype(
37    primitive = "Text",
38    item(prim = "Text", unbounded),
39    ty(
40        normalizer(path = "base::normalizer::text::Trim"),
41        normalizer(path = "base::normalizer::text::case::Title"),
42        rule(name = "length", kind = "length_range_inclusive", args(1, 100)),
43    )
44)]
45pub struct CityName {}
46
47///
48/// PostalCode
49///
50/// - Trim whitespace
51/// - Uppercase
52/// - Length: 3–12 chars
53/// - Allowed characters are not enforced
54///
55
56#[newtype(
57    primitive = "Text",
58    item(prim = "Text", unbounded),
59    ty(
60        normalizer(path = "base::normalizer::text::Trim"),
61        normalizer(path = "base::normalizer::text::case::Upper"),
62        rule(name = "length", kind = "length_range_inclusive", args(3, 12)),
63    )
64)]
65pub struct PostalCode {}
66
67///
68/// RegionName
69/// (state/province)
70///
71/// - Trim
72/// - Uppercase
73/// - Length: 2–50
74/// - Allowed characters are not enforced
75///
76
77#[newtype(
78    primitive = "Text",
79    item(prim = "Text", unbounded),
80    ty(
81        normalizer(path = "base::normalizer::text::Trim"),
82        normalizer(path = "base::normalizer::text::case::Upper"),
83        rule(name = "length", kind = "length_range_inclusive", args(2, 50)),
84    )
85)]
86pub struct RegionName {}