feat: add default value for serde
This commit is contained in:
@@ -4,7 +4,9 @@ use crate::mappings::SQLiteDatatypes;
|
|||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
pub struct Table {
|
pub struct Table {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
#[serde(default)]
|
||||||
pub columns: Vec<Column>,
|
pub columns: Vec<Column>,
|
||||||
|
#[serde(default)]
|
||||||
pub strict: bool
|
pub strict: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,11 +14,17 @@ pub struct Table {
|
|||||||
pub struct Column {
|
pub struct Column {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub datatype: SQLiteDatatypes,
|
pub datatype: SQLiteDatatypes,
|
||||||
|
#[serde(default)]
|
||||||
pub nullable: bool,
|
pub nullable: bool,
|
||||||
|
#[serde(default)]
|
||||||
pub default: Option<String>,
|
pub default: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
pub auto_increment: bool,
|
pub auto_increment: bool,
|
||||||
|
#[serde(default)]
|
||||||
pub unique: bool,
|
pub unique: bool,
|
||||||
|
#[serde(default)]
|
||||||
pub check_constraint: Option<String>, // raw check constraint
|
pub check_constraint: Option<String>, // raw check constraint
|
||||||
|
#[serde(default)]
|
||||||
pub primary_key: bool
|
pub primary_key: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user