orm_macro-1.2.0 has been yanked.
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
Table of contents
Installation
put this in your cargo.toml:
orm_macro = version = "1.2.0"
orm_macro_derive = version = "1.2.0"
The feature flag enabled by default is "postgres" which 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 =
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 struct_nameOrm
// works really well with Dto's
Find
async
Create
async
Update
async
Delete
async
Please suggest features or report bugs in the issues tabs