Procedural macro to automatically generate SQL statements traits TableStatement, SelectStatement, InsertStatement, DeleteStatement for the
provided struct as well as conversion to SQL parameters and from SQL rows.
How to use
You write:
# use *;
And you can use:
# use *;
#
#
use *;
let pool = new.unwrap;
let mut connection = pool.get_conn.unwrap;
handle;
Container attributes:
#[derive_sqlite(ident = ...)]overwrite the name of the wrapper fromSql{class};#[derive_sqlite(table_name = "...")]specify the name of the table (default to the container name in lower case);#[derive_sqlite(read_only = true/false)]specify whether to implement read/write (ie table, select, insert, update, delete, to params conversion and from row conversion) or read only statements (ie select and from row conversion)
Field attributes:
#[derive_sqlite(is_primary_key = true)]nominate that one of the field is a primary key. Only one primary key can be specified. primary key fields are unique in the table. Primary key can NOT be a String - the following will not compile:
# use derive_sql::*;
# use derive_sql_mysql::DeriveMysql;
#[derive(DeriveMysql)]
pub struct Person {
#[derive_sqlite(is_primary_key = true)]
name: String,
age: u32,
}