sea-orm/src/tests_cfg/lunch_set_expanded.rs
Billy Chan cef380b977
SQLite type mappings (#2077)
* sqlite: deps

* sqlite: update data type mappings

* sqlite: decimal test cases

* sqlite: try negative numbers

* fixup

* fixup

* fmt

* clippy

* fixup

* fixup

* fixup

* refactor

* fix

* Drop the use of `rust_decimal_macros` (#2078)

* sqlite: decimal -> real

* revert

* Bump dependencies

* Fixup

* Fixup

* Fixup

* Fixup

* Refactor

* Refactor

* Refactor
2024-02-05 14:42:55 +08:00

65 lines
1.3 KiB
Rust

use super::sea_orm_active_enums::*;
use crate as sea_orm;
use crate::entity::prelude::*;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"lunch_set"
}
}
#[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)]
#[sea_orm(table_name = "lunch_set")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
pub tea: Tea,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Name,
Tea,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i32;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Name => ColumnType::string(None).def(),
Self::Tea => Tea::db_type().def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}