Skip to main content

validate_field_name

Function validate_field_name 

Source
pub fn validate_field_name(s: &str) -> Result<(), SchemaError>
Expand description

Validate a field name against Anda DB’s naming rules.

A valid field name must:

  • be non-empty,
  • be at most 64 bytes long, and
  • contain only ASCII lowercase letters (az), digits (09) and underscores (_).

The _id field used as the document primary key is also a valid name.

§Arguments

  • s - The field name to validate

§Returns

  • Ok(()) if s is a legal field name.
  • Err(SchemaError::FieldName) describing the first violation otherwise.