waveless_commons/endpoint/generator.rs
1// Waveless
2// Copyright (C) 2026 Oscar Alvarez Gonzalez
3
4use crate::*;
5
6use databases::*;
7use endpoint::*;
8
9/// Establishes a method to discover a given schema and generates endpoints associated to it.
10#[typetag::serde]
11#[async_trait]
12pub trait AnyEndpointGenerator: Any + AnyExt + BoxedAny + DynClone + Send + Sync + Debug {
13 async fn generate(&self, db_conns: DbConns) -> Result<(Endpoints, Option<Bytes>)>;
14
15 /// Unique identifier associated with generator's config.
16 fn id(&self) -> Result<Bytes>;
17}