kyma_graph/source.rs
1//! Narrow read interface the schema-graph needs from a catalog. Keeping this
2//! tiny (3 methods) lets `SchemaGraphProvider` be unit-tested with a fake.
3
4use async_trait::async_trait;
5
6/// A column as the schema-graph sees it (decoupled from `kyma_core::ColumnInfo`).
7#[derive(Debug, Clone, PartialEq)]
8pub struct ColumnDef {
9 pub name: String,
10 /// kyma type token: `string`, `int`, `long`, `real`, `datetime`, `bool`, `dynamic`.
11 pub type_: String,
12 pub nullable: bool,
13}
14
15#[async_trait]
16pub trait SchemaSource: Send + Sync {
17 async fn databases(&self) -> anyhow::Result<Vec<String>>;
18 async fn tables(&self, database: &str) -> anyhow::Result<Vec<String>>;
19 async fn columns(&self, database: &str, table: &str) -> anyhow::Result<Vec<ColumnDef>>;
20}