mybatis-macro

Crates.iomybatis-macro
lib.rsmybatis-macro
version2.0.3
sourcesrc
created_at2022-05-08 21:07:16.907174
updated_at2022-05-20 05:48:52.582064
descriptionmybatis macro driver
homepagehttps://github.com/summer-rust/summer-mybatis/blob/master/mybatis-macro/README.md
repositoryhttps://github.com/summer-rust/summer-mybatis/tree/master/mybatis-macro
max_upload_size
id582715
size113,919
James Zow (Jzow)

documentation

https://github.com/summer-rust/summer-mybatis/blob/master/mybatis-macro/README.md

README

Mybatis Macro

This module contains some macros and attributes built into mybatis, The source code of all macros is in this module.

Getting Started

mybatis-macro = "2.0.3"

Macro description

1. Macro drive MybatisPlus

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>
}

2. Macro attribute mybatis_plus

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>
}

3. Macro attribute mybatis_sql

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 {}

4. Macro attribute py_sql

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 {}

5. Macro attribute mybatis_html

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 {}
Commit count: 564

cargo fmt