ormer
English | 简体中文
An ORM framework with a usage style similar to Linq, supporting Turso(SQLite), PostgresQL, MySQL.
Usage
Add the library reference:
1. Define Model
Use the #[derive(Model)] macro to define your database model:
use Model;
2. Connect to Database
use Database;
use DbType;
async
3. Create Table
db..await?;
4. Insert Data
db.insert.await?;
5. Query Data
let users = db...await?;
println!;
6. Transaction
let txn = db.begin.await?;
txn.insert.await?;
txn.commit.await?;
Features
- turso (default): Use Turso/libsql database backend
- postgresql: Use PostgreSQL database backend
- mysql: Use MySQL database backend
Enable features in your Cargo.toml:
[]
= { = "0.1", = ["postgresql"] }