modelvault-core 0.16.0

Core engine for ModelVault — application-focused embedded storage with model schemas, validation, and migrations.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Shared helpers for collection naming rules.

use crate::catalog::MAX_COLLECTION_NAME_BYTES;
use crate::error::{DbError, SchemaError};

pub(crate) fn normalize_collection_name(name: &str) -> Result<String, DbError> {
    let name = name.trim();
    if name.is_empty() {
        return Err(DbError::Schema(SchemaError::InvalidCollectionName));
    }
    if name.len() > MAX_COLLECTION_NAME_BYTES {
        return Err(DbError::Schema(SchemaError::InvalidCollectionName));
    }
    Ok(name.to_string())
}