Skip to content

behemehal/SafeEn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")

Releases

No releases published

Packages

No packages published

Languages