Crates.io | toql_sql_expr_parser |
lib.rs | toql_sql_expr_parser |
version | 0.4.0 |
source | src |
created_at | 2021-10-20 13:06:59.74884 |
updated_at | 2021-12-04 10:09:15.538539 |
description | Library with SQL expression parser for Toql |
homepage | |
repository | https://github.com/roy-ganz/toql |
max_upload_size | |
id | 467897 |
size | 2,163 |
Beginner Guide | API documentation
Toql is an ORM for async databases that features
It currently only supports MySQL. More are coming, promised :)
Add this to your Cargo.toml
:
[dependencies]
toql = {version = "0.4", features = ["serde"]}
toql_mysql_async = "0.4"
Derive your structs:
#[derive(Toql)]
#[toql(auto_key)]
struct Todo {
#[toql(key)]
id: u64,
what: String,
#[toql(join)]
user: User
}
And do stuff with them:
let toql = ...
let todo = Todo{ ... };
// Insert todo and update its generated id
toql.insert_one(&mut todo, paths!(top)).await?;
// Compile time checked queries!
let q = query!(Todo, "*, user_id eq ?", &todo.user.id);
// Typesafe loading
let todos = toql.load_many(q).await?;
Check out the CRUD example.
Comments, bug fixes and quality improvements are welcome.
Toql is distributed under the terms of both the MIT license and the Apache License (Version 2.0).