backbone-bucket 0.3.0

Bucket Bounded Context: File Storage Module for Backbone Framework
Documentation
//! Validator for AccessLog entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<AccessLog>` pre-loaded with schema-derived
//! field rules. Extend in the `// <<< CUSTOM` zone.

use backbone_core::{EntityValidator, ValidationErrors, ValidationError};
use backbone_core::{OptionalNotBlank};
use crate::domain::entity::AccessLog;

/// Validator type alias for AccessLog entities.
pub type AccessLogValidator = EntityValidator<AccessLog>;

/// Build a validator for AccessLog with all schema-defined field rules.
pub fn access_log_validator() -> AccessLogValidator {
    EntityValidator::new()
        .rule(OptionalNotBlank::new("ip_address", |e: &AccessLog| e.ip_address.as_deref()))
        .rule(OptionalNotBlank::new("user_agent", |e: &AccessLog| e.user_agent.as_deref()))
        .rule(OptionalNotBlank::new("referer", |e: &AccessLog| e.referer.as_deref()))
        .rule(OptionalNotBlank::new("country_code", |e: &AccessLog| e.country_code.as_deref()))
        .rule(OptionalNotBlank::new("city", |e: &AccessLog| e.city.as_deref()))
        .rule(OptionalNotBlank::new("error_message", |e: &AccessLog| e.error_message.as_deref()))
    // <<< CUSTOM RULES
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM