pub struct JsonDB { /* private fields */ }
Expand description
Implementations§
source§impl JsonDB
impl JsonDB
sourcepub fn create_collection<S>(
self,
collection_path: S
) -> Result<JsonDB, Box<dyn Error>>where
S: Into<String>,
pub fn create_collection<S>(
self,
collection_path: S
) -> Result<JsonDB, Box<dyn Error>>where
S: Into<String>,
Creates a new collection either in your database or in another collection
Examples
db.create_collection("your collection path")?;
sourcepub fn write<J, S>(
self,
collection_path: S,
document: S,
data: J
) -> Result<JsonDB, Box<dyn Error>>where
J: Serialize,
S: Into<String>,
pub fn write<J, S>(
self,
collection_path: S,
document: S,
data: J
) -> Result<JsonDB, Box<dyn Error>>where
J: Serialize,
S: Into<String>,
Writes (or rewrites) data to document in collection
Examples
db.write("your collection path", "your document", "struct that derives serde::serialize")?;