[−][src]Struct unqlite::UnQLite
UnQLite database entry point.
UnQLite support both in-memory and on-disk database. There's several constructors:
Constructor | Meaning |
---|---|
create_in_memory | Create a private, in-memory database. |
create_temp | Create a private, temporary on-disk database. |
create | Create if not exists, otherwise, open as read-write. |
open_mmap | Obtain a read-only memory view of the whole database. |
open_readonly | Open the database in a read-only mode. |
Implementations
impl UnQLite
[src]
pub fn create<P: AsRef<str>>(filename: P) -> UnQLite
[src]
Create UnQLite database as filename
.
By default, the database is created in read-write mode.
Panics
Will panic if failed in creating.
Example
let _ = UnQLite::create("test.db");
C
unqlite *pDb;
// on-disk database
rc = unqlite_open(&pDb,"test.db",UNQLITE_OPEN_CREATE);
// in-memory database
rc = unqlite_open(&pDb, ":mem:", UNQLITE_OPEN_MEM);
pub fn create_in_memory() -> UnQLite
[src]
Create database in memory.
Equivalent to:
let _ = UnQLite::create(":mem:");
Panics
Will panic if failed in creating.
pub fn create_temp() -> UnQLite
[src]
A private, temporary on-disk database will be created.
This private database will be automatically deleted as soon as the database connection is closed.
Panics
Will panic if failed in creating.
C
int rc = unqlite_open("test.db", UNQLITE_OPEN_TEMP_DB);
pub fn open_mmap<P: AsRef<str>>(filename: P) -> UnQLite
[src]
Obtain a read-only memory view of the whole database.
You will get significant performance improvements with this combination but your database is still read-only.
Panics
Panic if open failed.
C
unqlite_open(&pDb, "test.db", UNQLITE_OPEN_MMAP | UNQLITE_OPEN_READONLY);
pub fn open_readonly<P: AsRef<str>>(filename: P) -> UnQLite
[src]
Trait Implementations
impl Config for UnQLite
[src]
fn max_page_cache(self, max: u32) -> Self
[src]
fn disable_auto_commit(self) -> Self
[src]
fn kv_engine<S: Into<Vec<u8>>>(self, name: S) -> Self
[src]
fn err_log(&self) -> Option<String>
[src]
fn jx9_err_log(&self) -> Option<String>
[src]
fn kv_name(&self) -> String
[src]
impl Cursor for UnQLite
[src]
fn first(&self) -> Option<Entry>
[src]
fn last(&self) -> Option<Entry>
[src]
fn seek<K: AsRef<[u8]>>(&self, key: K, pos: Direction) -> Option<Entry>
[src]
impl Drop for UnQLite
[src]
impl Jx9 for UnQLite
[src]
Jx9 script compiler Interface.
fn compile<T: AsRef<[u8]>>(&self, jx9: T) -> Result<UnQLiteVm>
[src]
Compile a Jx9 script to a bytecode program.
fn compile_file<P: AsRef<str>>(&self, filename: P) -> Result<UnQLiteVm>
[src]
Compile a Jx9 script file to a bytecode program.
impl KV for UnQLite
[src]
Key-Value Store Interface
fn kv_store<K: AsRef<[u8]>, V: AsRef<[u8]>>(
&self,
key: K,
value: V
) -> Result<()>
[src]
&self,
key: K,
value: V
) -> Result<()>
fn kv_append<K: AsRef<[u8]>, V: AsRef<[u8]>>(
&self,
key: K,
value: V
) -> Result<()>
[src]
&self,
key: K,
value: V
) -> Result<()>
fn kv_delete<K: AsRef<[u8]>>(&self, key: K) -> Result<()>
[src]
fn kv_contains<K: AsRef<[u8]>>(&self, key: K) -> bool
[src]
fn kv_fetch_length<K: AsRef<[u8]>>(&self, key: K) -> Result<i64>
[src]
fn kv_fetch<K: AsRef<[u8]>>(&self, key: K) -> Result<Vec<u8>>
[src]
fn kv_fetch_callback<K: AsRef<[u8]>>(
&self,
key: K,
consumer: extern "C" fn(data: *const c_void, len: u32, user_data: *mut c_void) -> i32
) -> Result<()>
[src]
&self,
key: K,
consumer: extern "C" fn(data: *const c_void, len: u32, user_data: *mut c_void) -> i32
) -> Result<()>
fn kv_config_hash(
&self,
hash: extern "C" fn(key: *const c_void, len: u32) -> u32
) -> Result<()>
[src]
&self,
hash: extern "C" fn(key: *const c_void, len: u32) -> u32
) -> Result<()>
fn kv_config_cmp(
&self,
cmp: extern "C" fn(key: *const c_void, len: u32) -> u32
) -> Result<()>
[src]
&self,
cmp: extern "C" fn(key: *const c_void, len: u32) -> u32
) -> Result<()>
impl Send for UnQLite
[src]
impl Sync for UnQLite
[src]
impl Transaction for UnQLite
[src]
fn begin(&self) -> Result<()>
[src]
fn commit(&self) -> Result<()>
[src]
fn rollback(&self) -> Result<()>
[src]
impl Util for UnQLite
[src]
fn random_string(&self, buf_size: u32) -> Vec<u8>
[src]
fn random_num(&self) -> u32
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,