schema_sql_generator/common/
key_generator.rs1use schema_model::model::table::Table;
2use crate::common::generator_context::GeneratorContext;
3
4pub trait KeyGenerator {
5 fn key_constraints(&self, table: &Table) -> Vec<String>;
6}
7
8pub struct DefaultKeyGenerator {
9 context: GeneratorContext,
10}
11
12impl DefaultKeyGenerator {
13 pub fn new(context: GeneratorContext) -> Self {
14 Self {
15 context,
16 }
17 }
18
19 pub fn context(&self) -> &GeneratorContext {
20 &self.context
21 }
22}
23
24impl KeyGenerator for DefaultKeyGenerator {
25 fn key_constraints(&self, _table: &Table) -> Vec<String> {
26 vec![]
27 }
28}