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