1mod document;
2mod error;
3mod field;
4mod resource;
5mod schema;
6mod value_serde;
7
8pub use anda_db_derive::{AndaDBSchema, FieldTyped};
9
10pub use document::*;
11pub use error::*;
12pub use field::*;
13pub use resource::*;
14pub use schema::*;
15
16pub fn validate_field_name(s: &str) -> Result<(), SchemaError> {
29 if s.is_empty() {
30 return Err(SchemaError::FieldName("empty string".to_string()));
31 }
32
33 if s.len() > 64 {
34 return Err(SchemaError::FieldName(format!(
35 "string length {} exceeds the limit 64",
36 s.len()
37 )));
38 }
39
40 for c in s.chars() {
41 if !matches!(c, 'a'..='z' | '0'..='9' | '_' ) {
42 return Err(SchemaError::FieldName(format!(
43 "Invalid character {c:?} in {s:?}"
44 )));
45 }
46 }
47 Ok(())
48}