Tired of learning super complex Orms? bored of doing sqlbuilder.select("fields").from("table") (which becomes outdated as your code evolves)? sometimes you just want a quick, easy to use sql statement that matches your structs definitions even if it changes, well this crate is for you
Disclaimer
I am new to rust and at the time I didn“t know how versioning works, so although the version says it's in 1.. this crate is still subject to changes
Table of contents
Installation
put this in your cargo.toml:
orm_macro = "1.3.0"
orm_macro_derive =
The feature flag "postgres" uses postgres style bindings, for example:
DELETE FROM table WHERE id = $1 # postgres bindings
DELETE FROM table WHERE id = ? # this bindings are used by mysql and sqlite
If you want to use mysql bindings then in your cargo.toml
orm_macro = "1.3.0"
orm_macro_derive =
Usage
I will be using this structs as examples and sqlx as a database driver
///bring this to scope
use OrmRepository;
use GetRepository;
//GetRepository will make a new struct with methods that
//build sql statements using your struct fields
//The new struct will be named {yourStructName}Orm
// Set the id of your table, this will be used in RETURNING and where clauses
// works really well with Dto's
// Set the id of your table, this will be used en the RETURNING clauses
// Set the id of your table, this will be used en the RETURNING clauses
Find
async
Find by id
async
Create
async
Update
async
Delete
async
Please suggest features or report bugs in the issues tabs