-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathbatch_transfer.rs
More file actions
87 lines (74 loc) · 2.09 KB
/
batch_transfer.rs
File metadata and controls
87 lines (74 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
use sea_orm::entity::prelude::*;
use crate::database::enums::TransferStatus;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"batch_transfer"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq)]
pub struct Model {
pub idx: i32,
pub txid: Option<String>,
pub status: TransferStatus,
pub created_at: i64,
pub updated_at: i64,
pub expiration: Option<i64>,
pub exact_expiry: Option<bool>,
pub min_confirmations: u8,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Idx,
Txid,
Status,
CreatedAt,
UpdatedAt,
Expiration,
ExactExpiry,
MinConfirmations,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Idx,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i32;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
AssetTransfer,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Idx => ColumnType::Integer.def(),
Self::Txid => ColumnType::String(StringLen::None).def().null(),
Self::Status => ColumnType::SmallInteger.def(),
Self::CreatedAt => ColumnType::BigInteger.def(),
Self::UpdatedAt => ColumnType::BigInteger.def(),
Self::Expiration => ColumnType::BigInteger.def().null(),
Self::ExactExpiry => ColumnType::Boolean.def().null(),
Self::MinConfirmations => ColumnType::SmallInteger.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::AssetTransfer => Entity::has_many(super::asset_transfer::Entity).into(),
}
}
}
impl Related<super::asset_transfer::Entity> for Entity {
fn to() -> RelationDef {
Relation::AssetTransfer.def()
}
}
impl ActiveModelBehavior for ActiveModel {}