icydb_schema/
lib.rs

1pub mod build;
2pub mod error;
3pub mod node;
4pub mod types;
5pub mod visit;
6
7/// Maximum length for entity schema identifiers.
8pub const MAX_ENTITY_NAME_LEN: usize = 64;
9/// Maximum length for field schema identifiers.
10pub const MAX_FIELD_NAME_LEN: usize = 64;
11/// Maximum number of fields allowed in a derived index.
12pub const MAX_INDEX_FIELDS: usize = 4;
13/// Maximum length for derived index identifiers.
14pub const MAX_INDEX_NAME_LEN: usize =
15    MAX_ENTITY_NAME_LEN + (MAX_INDEX_FIELDS * (1 + MAX_FIELD_NAME_LEN));
16
17use crate::{build::BuildError, node::NodeError};
18use thiserror::Error as ThisError;
19
20///
21/// Prelude
22///
23
24pub mod prelude {
25    pub(crate) use crate::build::{schema_read, validate::validate_ident};
26    pub use crate::{
27        err,
28        error::ErrorTree,
29        node::*,
30        types::{Cardinality, Primitive, StoreType},
31        visit::Visitor,
32    };
33    pub use candid::CandidType;
34    pub use serde::{Deserialize, Serialize};
35}
36
37///
38/// Error
39///
40
41#[derive(Debug, ThisError)]
42pub enum Error {
43    #[error(transparent)]
44    BuildError(#[from] BuildError),
45
46    #[error(transparent)]
47    NodeError(#[from] NodeError),
48}