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
use ;
use quote;
use crateTableField;
/// Entity to Model
/// ### Usage (add TableData Automatic generation Entity)
/// ```
/// use serde::{Deserialize, Serialize};
/// use sqlx::FromRow;
/// use mydb::TableData;
///
/// #[derive(TableData, Debug, Clone, Default, FromRow, Deserialize, Serialize)]
/// #[mydb(table_name = "sys_user")]
/// pub struct Model {
/// pub username: String,
/// pub password: String,
/// #[table_field(exist)]
/// pub role_ids: Vec<u64>,
/// }
///
/// let sys_user_entity: Entity = Entity {
/// username: format!("admin"),
/// password: format!("96e79218965eb72c92a549dd5a330112"),
/// ..Default::default()
/// };
///
/// let m: Model = sys_user_entity.into();
/// m.role_ids = vec![1, 2];
/// println!("model : {:#?}", m);
/// ```