4 releases

0.1.3 Apr 3, 2024
0.1.2 Mar 17, 2024
0.1.1 Mar 6, 2024
0.1.0 Mar 4, 2024

#1222 in Database interfaces

Download history 92/week @ 2024-02-28 211/week @ 2024-03-06 193/week @ 2024-03-13 20/week @ 2024-03-20 2/week @ 2024-03-27 116/week @ 2024-04-03 2/week @ 2024-04-10

120 downloads per month

MIT license

27KB
687 lines

Lumus sql builder

About project

The project is an SQL query builder that allows you to create complex SQL queries programmatically and intuitively. It supports a variety of SQL operations, including column selection, joins, WHERE clauses, grouping, sorting, and much more.

Here is an example of how the code can be used to build an SQL query:

use lumus_sql_builder::sqlite::{CreateTable, Column};

fn main() {
    let create_table = CreateTable::new("employees", vec![
        Column::new("id").integer().primary_key().auto_increment(),
        Column::new("name").text().not_null(),
        Column::new("age").integer().not_null(),
        Column::new("department").text().default("'Undefined'"),
        Column::new("salary").real(),
        Column::new("hired_date").datetime(),
        Column::new("manager_id").integer()
    ]);

    println!("{}", create_table.build());
}

Output:

CREATE TABLE employees (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    age INTEGER NOT NULL,
    department TEXT DEFAULT 'Undefined',
    salary REAL
    hired_date DATETIME,
    manager_id INTEGER
);

No runtime deps