71 lines
1.7 KiB
Rust
71 lines
1.7 KiB
Rust
|
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
|
||
|
|
||
|
use sea_orm::entity::prelude::*;
|
||
|
use serde::{Deserialize, Serialize};
|
||
|
|
||
|
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
|
||
|
pub struct Entity;
|
||
|
|
||
|
impl EntityName for Entity {
|
||
|
fn table_name(&self) -> &str {
|
||
|
"oauth"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
|
||
|
pub struct Model {
|
||
|
pub id: String,
|
||
|
pub display_name: String,
|
||
|
pub application_name: String,
|
||
|
pub install_url: Option<String>,
|
||
|
pub uninstall_url: Option<String>,
|
||
|
pub data: Option<Json>,
|
||
|
}
|
||
|
|
||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
|
||
|
pub enum Column {
|
||
|
Id,
|
||
|
DisplayName,
|
||
|
ApplicationName,
|
||
|
InstallUrl,
|
||
|
UninstallUrl,
|
||
|
Data,
|
||
|
}
|
||
|
|
||
|
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
|
||
|
pub enum PrimaryKey {
|
||
|
Id,
|
||
|
}
|
||
|
|
||
|
impl PrimaryKeyTrait for PrimaryKey {
|
||
|
type ValueType = String;
|
||
|
fn auto_increment() -> bool {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[derive(Copy, Clone, Debug, EnumIter)]
|
||
|
pub enum Relation {}
|
||
|
|
||
|
impl ColumnTrait for Column {
|
||
|
type EntityName = Entity;
|
||
|
fn def(&self) -> ColumnDef {
|
||
|
match self {
|
||
|
Self::Id => ColumnType::String(None).def(),
|
||
|
Self::DisplayName => ColumnType::String(None).def(),
|
||
|
Self::ApplicationName => ColumnType::String(None).def(),
|
||
|
Self::InstallUrl => ColumnType::String(None).def().null(),
|
||
|
Self::UninstallUrl => ColumnType::String(None).def().null(),
|
||
|
Self::Data => ColumnType::JsonBinary.def().null(),
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl RelationTrait for Relation {
|
||
|
fn def(&self) -> RelationDef {
|
||
|
panic!("No RelationDef")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl ActiveModelBehavior for ActiveModel {}
|