Struct persistent_keystore_rs::Database [−][src]
Expand description
Database; a collection of Tables
Fields
sync_interval: Option<Duration>
Implementations
Sets the Sync Duration of the Database.
Note this is currently only utilized by the Client
use persistent_keystore_rs::Database;
use std::time::Duration;
let mut database = Database::default();
database.set_sync_duration(Duration::from_secs(60));
Removes the Sync Duration of the Database.
Note this is currently only utilized by the Client
use persistent_keystore_rs::Database;
let mut database = Database::default();
database.remove_sync_duration();
Returns a mutable reference to a Table within the Database
use persistent_keystore_rs::Database;
let mut database = Database::default();
let table = database.get_table(&"MyTable".to_string()).unwrap();
Creates a Table within the Database
use persistent_keystore_rs::{Database, Table, FieldType};
use std::time::Duration;
let table = Table::new()
.name("MyTable".to_string())
.primary_field(FieldType::String).unwrap()
.add_field("Count".to_string(), FieldType::I64).unwrap()
.add_optional_field("Notes".to_string(), FieldType::String).unwrap()
.add_expiration(Duration::from_secs(60))
.build().unwrap();
let mut database = Database::default();
database.create_table(table).unwrap();
Deletes the specified Table within the Database
use persistent_keystore_rs::Database;
let mut database = Database::default();
database.drop_table(&"MyTable".to_string()).unwrap();
Returns a Vec of Table names that are stored within the Database
use persistent_keystore_rs::Database;
let mut database = Database::default();
let tables = database.list_tables();
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Database
impl UnwindSafe for Database
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more