use scythe_core::analyzer::{AnalyzedQuery, CompositeInfo, EnumInfo};
use scythe_core::errors::ScytheError;
#[derive(Debug, Clone)]
pub struct ResolvedColumn {
pub name: String,
pub field_name: String,
pub lang_type: String,
pub full_type: String,
pub neutral_type: String,
pub nullable: bool,
}
#[derive(Debug, Clone)]
pub struct ResolvedParam {
pub name: String,
pub field_name: String,
pub lang_type: String,
pub full_type: String,
pub borrowed_type: String,
pub neutral_type: String,
pub nullable: bool,
}
pub trait CodegenBackend: Send + Sync {
fn name(&self) -> &str;
fn generate_row_struct(
&self,
query_name: &str,
columns: &[ResolvedColumn],
) -> Result<String, ScytheError>;
fn generate_model_struct(
&self,
table_name: &str,
columns: &[ResolvedColumn],
) -> Result<String, ScytheError>;
fn generate_query_fn(
&self,
analyzed: &AnalyzedQuery,
struct_name: &str,
columns: &[ResolvedColumn],
params: &[ResolvedParam],
) -> Result<String, ScytheError>;
fn generate_enum_def(&self, enum_info: &EnumInfo) -> Result<String, ScytheError>;
fn generate_composite_def(&self, composite: &CompositeInfo) -> Result<String, ScytheError>;
fn file_header(&self) -> String {
String::new()
}
}