drizzle_sqlite/
traits.rs

1use std::any::Any;
2
3use crate::SQLiteValue;
4use drizzle_core::{SQLColumn, SQLColumnInfo};
5
6pub trait SQLiteColumn<'a>: SQLColumn<'a, SQLiteValue<'a>> {
7    const AUTOINCREMENT: bool = false;
8}
9
10pub trait SQLiteColumnInfo: SQLColumnInfo + Any {
11    fn is_autoincrement(&self) -> bool;
12}
13
14impl std::fmt::Debug for &dyn SQLiteColumnInfo {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16        f.debug_struct("SQLiteColumnInfo")
17            .field("name", &self.name())
18            .field("type", &self.r#type())
19            .field("not_null", &self.is_not_null())
20            .field("primary_key", &self.is_primary_key())
21            .field("unique", &self.is_unique())
22            .field("table", &self.table())
23            .field("has_default", &self.has_default())
24            .field("is_autoincrement", &self.is_autoincrement())
25            .finish()
26    }
27}