pub struct JSDB<Value> {
pub databases: HashMap<String, Database<Value>>,
}
Expand description
JSDB: A lightweight, high-performance database API for Rust.
The JSDB
crate provides a simple, database management system designed for
ease of use and flexibility. It organizes data hierarchically with environments (JSDB
),
databases (Database
), tables (Table
), rows (Row
), and columns. This structure
supports generic data types, allowing developers to store various kinds of values.
§Features
- Create and manage multiple databases within a single environment.
- Support for generic value types in rows.
- Simple API for adding and removing databases.
§Usage
The JSDB
struct is the entry point for interacting with the database system. Use it to
create an environment, add databases, and manage data.
§Examples
use jsdb::JSDB;
use jsdb::database::database::Database;
// Create a new JSDB environment
let mut project: JSDB<String> = JSDB::new();
// Create a database and add it to the environment
let db1 = Database::create_database();
project.add_database("my_database", db1);
// Remove a database
project.delete_database("my_database");
§Notes
- This is an in-memory database, so data is not persisted to disk.
- Ensure unique database names to avoid overwriting existing databases.
Fields§
§databases: HashMap<String, Database<Value>>
Implementations§
Source§impl<Value> JSDB<Value>
impl<Value> JSDB<Value>
Sourcepub fn add_database(&mut self, name: &str, database: Database<Value>)
pub fn add_database(&mut self, name: &str, database: Database<Value>)
Adds database to the environment HashMap
Sourcepub fn delete_database(&mut self, name: &str)
pub fn delete_database(&mut self, name: &str)
Removes database from the environment HashMap
Trait Implementations§
Auto Trait Implementations§
impl<Value> Freeze for JSDB<Value>
impl<Value> RefUnwindSafe for JSDB<Value>where
Value: RefUnwindSafe,
impl<Value> Send for JSDB<Value>where
Value: Send,
impl<Value> Sync for JSDB<Value>where
Value: Sync,
impl<Value> Unpin for JSDB<Value>where
Value: Unpin,
impl<Value> UnwindSafe for JSDB<Value>where
Value: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more