lenso-platform-core 0.1.0

Core runtime primitives for the Lenso backend framework.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fmt::Debug;
use std::sync::Arc;
use uuid::Uuid;

pub trait IdGenerator: Debug + Send + Sync {
    fn new_id(&self, prefix: &str) -> String;
}

pub type DynIdGenerator = Arc<dyn IdGenerator>;

#[derive(Debug, Default)]
pub struct UuidGenerator;

impl IdGenerator for UuidGenerator {
    fn new_id(&self, prefix: &str) -> String {
        format!("{prefix}_{}", Uuid::now_v7())
    }
}