#store #file #txt #db #save #local #local-file

simple_db

rust databasing crate for local file store

2 releases

0.1.2 Jan 18, 2025
0.1.1 Nov 29, 2024
0.1.0 Nov 29, 2024

#17 in #txt

Download history 218/week @ 2024-11-27 49/week @ 2024-12-04 25/week @ 2024-12-11 109/week @ 2025-01-15

109 downloads per month

MIT license

7KB
99 lines

simpleDB | key value database file store

Checkout colondb crate for multiple column support.

[!NOTE] The simple_db struct is not the database itself, its just a way to apply changes to the .txt where the database is saved


usage

add to Cargo.toml

cargo add simple_db

use in main.rs

use simple_db::SimpleDB;

Methods:

find save file, or create one

let mut database = SimpleDB::find_database("db3.txt");
let mut db = database.unwrap(); // this or handle the error

You have to .to_string() input values. Like so:

database.insert_into_db(key, value); // add key value pair to database

get value by id (key)

database.get_value_from_db(key)

delete value by key

database.delete_from_db(key)

sort the database

db.sort_by_key();
db.sort_by_value();

to edit the data yourself:

db.data... // the data here is an indexmap of string: string

print db

db.print_db()

Dependencies

~1MB
~17K SLoC