macro_rules! sql_struct {
(
impl $ty:ty {
$(
$field:ident : { db: $db:literal, $(orig: $orig:literal,)? tags: [ $($tag:literal),* $(,)? ], omitempty: [ $($omit:literal),* $(,)? ], quote: $quote:literal, as: $as:expr }
),* $(,)?
}
) => { ... };
}Expand description
声明一个可用于 Struct<T> 的业务 struct 元数据与取值逻辑。
用法示例:
ⓘ
#[derive(Default)]
struct User { id: i64, name: String }
sql_builder::sql_struct! {
impl User {
id: { db: "id", tags: ["pk"], omitempty: [], quote: false, as: None },
name:{ db: "name", tags: [], omitempty: [""], quote: true, as: None },
}
}