| Crates.io | lume |
| lib.rs | lume |
| version | 0.13.1 |
| created_at | 2025-08-15 12:11:56.458481+00 |
| updated_at | 2025-12-12 19:49:50.031055+00 |
| description | A simple and intuitive Query Builder inspired by Drizzle |
| homepage | |
| repository | https://github.com/guru901/lume |
| max_upload_size | |
| id | 1796647 |
| size | 358,437 |
A type-safe, ergonomic query builder and ORM for SQL databases, inspired by Drizzle ORM.
Add Lume to your Cargo.toml:
[dependencies]
lume = { version = "0.12", features = ["mysql"] }
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
use lume::{database::Database, define_schema, filter::eq_value};
// Define your database schema
define_schema! {
Users {
id: Uuid [primary_key().not_null().default_random()],
username: String [not_null()],
email: String,
age: i32,
created_at: i64 [not_null()],
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Connect to your database
let db = Database::connect("mysql://user:password@localhost/database").await?;
// Create tables (if they don't exist)
db.register_table::<Users>().await?;
// Insert a new user
db.insert(Users {
id: None,
username: "john_doe".to_string(),
email: "john.doe@example.com".to_string(),
age: 25,
created_at: 1677721600,
})
.execute()
.await?;
// Query users
let users = db
.query::<Users, SelectUsers>()
.filter(eq_value(Users::username(), "john_doe"))
.execute()
.await?;
for user in users {
let username: Option<String> = user.get(Users::username());
println!("User: {}", username.unwrap_or_default());
}
Ok(())
}
Lume supports multiple database backends through feature flags:
lume = { version = "0.12", features = ["mysql"] }lume = { version = "0.12", features = ["postgres"] }lume = { version = "0.12", features = ["sqlite"] }Lume automatically maps Rust types to SQL types:
| Rust Type | SQL Type |
|---|---|
String |
VARCHAR(255) |
i8 |
TINYINT |
i16 |
SMALLINT |
i32 |
INT |
i64 |
BIGINT |
u8 |
TINYINT UNSIGNED |
u16 |
SMALLINT UNSIGNED |
u32 |
INT UNSIGNED |
u64 |
BIGINT UNSIGNED |
f32 |
FLOAT |
f64 |
DOUBLE |
bool |
BOOLEAN |
time::OffsetDateTime |
DATETIME |
We are not accepting contributions at this time. We will be accepting pull requests in the future, for now you can open an issue to discuss your ideas.
This project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG.md for a detailed list of changes and improvements.