way-lib-rust 0.0.3

foundation for all Ampliway services
Documentation
use crate::id::v1::base::V1;

#[derive(Debug)]
pub struct ID;

impl ID {
    pub fn new() -> Self {
        ID {}
    }
}

impl V1 for ID {
    fn make(&self) -> String {
        ulid::Ulid::new().to_string().to_lowercase()
    }

    fn is_valid(&self, value: String) -> bool {
        if value.is_empty() {
            return false;
        }

        if value.len() != 26 {
            return false;
        }

        true
    }
}