to_sql_string trait definition

This commit is contained in:
pedrocarlo
2025-05-26 17:57:24 -03:00
parent 9f17be8162
commit 2ac2990b4c
2 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
//! ToSqlString trait definition and implementations
use crate::ast::TableInternalId;
/// Context to be used in ToSqlString
pub trait ToSqlContext {
/// Given an id, get the table name
/// Currently not considering alias
fn get_table_name(&self, id: TableInternalId) -> &str;
}
/// Trait to convert an ast to a string
pub trait ToSqlString<C: ToSqlContext> {
/// Convert the given value to String
fn to_sql_string(&self, context: &C) -> String;
}