9 stable releases

1.8.0 May 5, 2022
1.7.12 May 5, 2022
1.6.5 Apr 3, 2022

#1560 in Database interfaces

22 downloads per month

GPL-2.0 license

72KB
1.5K SLoC

SafeEn

Crates.io Version Documentation

Local database solution for sit

Local database solution for situations that requires strict data integrity and absolute portability

use safe_en::{
    table::{TableRow, TypeDefs},
    Database,
};

let mut db = Database::new();

db.set_name("users".to_string());

db.create_table(
    "users",
    vec![
        TableRow::new("id", TypeDefs::I64),
        TableRow::new("email", TypeDefs::String),
    ],
).unwrap();


let id = 1_i64;;
let email = "ahmet@mail.com";

db.table("users").unwrap().insert(vec![id.into(), email.into()]).unwrap();

let list_entries = table.get_where(|x| x.row("email").is("ahmet@mail.com"));

for entry in list_entries {
    println!("{}", entry);
}

db.save("./examples/db.sfn")

lib.rs:

SafeEn

Local database solution with clean and strict data integrity.

Usage

use safe_en::{
    table::{TableRow, TypeDefs},
    Database,
};
let mut db = Database::new();
db.create_table(
    "users",
    vec![
        TableRow::new("id", TypeDefs::I64),
        TableRow::new("email", TypeDefs::String),
    ],
)
.unwrap();


let id = 1_i64;;
let email = "ahmet@mail.com";

db.table("users").unwrap().insert(vec![id.into(), email.into()]).unwrap();

You can find more examples here

No runtime deps