modelite 0.3.1

Automatically generate create table and other SQLite queries for a struct
Documentation

Modelite

Crates.io License Crates.io Version

Modelite defines traits and macros to generate SQL queries as strings, or to be used with sqlx (with feature "sqlx", enabled by default).

#[derive(Model)]
struct Person {
    name: String,
    age: u32,
    nickname: Option<String>
}

#[tokio::main]
async fn main() {
    let pool = SqlitePool::connect("sqlite::memory:").await.unwrap();
    
    Person::create_table().execute(&pool);
    Person::insert_bulk(&pool, &[Person {
        name: String::from("Steven"),
        age: 35,
        nickname: None
    }]).execute_all(&pool);
}