Crates.io | mybatis-macro |
lib.rs | mybatis-macro |
version | 2.0.3 |
source | src |
created_at | 2022-05-08 21:07:16.907174 |
updated_at | 2022-05-20 05:48:52.582064 |
description | mybatis macro driver |
homepage | https://github.com/summer-rust/summer-mybatis/blob/master/mybatis-macro/README.md |
repository | https://github.com/summer-rust/summer-mybatis/tree/master/mybatis-macro |
max_upload_size | |
id | 582715 |
size | 113,919 |
This module contains some macros and attributes built into mybatis, The source code of all macros is in this module.
mybatis-macro = "2.0.3"
This macro is mainly used to automatically map the conditional packaging of some built-in operation tables. You can realize the basic operations of querying, deleting, adding and modifying data tables without spelling SQL statements
#[derive(MybatisPlus)]
pub struct Book {
pub id: Option<String>,
pub name: Option<String>,
pub types: Option<String>
}
The function of this macro is the same as that of MybatisPlus macro, except that this macro is used for attribute.
#[mybatis_plus]
pub struct Book {
pub id: Option<String>,
pub name: Option<String>,
pub types: Option<String>
}
#[mybatis_plus(table_name:"book")]
pub struct Book {
pub id: Option<String>,
pub name: Option<String>,
pub types: Option<String>
}
This macro is mainly used to automatically create SQL statements for you. You can write SQL statements in the macro corresponding to a method implementation.
#[mybatis_sql("select * from book where id = ?")]
async fn select(mybatis:&Mybatis, id: &str) -> Book {}
This macro is mainly used to process pysql, and its function is similar to that of mybatis_sql macro
#[py_sql("select * from book where name = "《test》"")]
async fn py_select(name: &str) -> Book {}
This macro is mainly used to parse the SQL syntax structure in HTML. The bottom layer is to parse the HTML file in the specified directory through HTML parse
#[mybatis_html("example/example.html")]
async fn html_parse_mybatis(mybatis: &Mybatis, name: &str) -> Book {}