memory
Module[Memory]: the in-memory adapter.
use utopia_database::Adapter;
use utopia_database::adapter::memory::Memory;
let adapter = Memory::new();
adapter.set_database("app")?;
adapter.create("app").await?;
assert!(adapter.exists("app", None).await?);Contents
3 submodules, and what the module defines itself.
use utopia_database::adapter::memory::Memory;pub struct MemoryThe in-memory adapter. See the module docs.
Default.memory::documents
Own pageDocuments: reads, creates, updates, deletes, sequences, increments, the permission indexes and the unique-index hash tables.
memory::schema
Own pageDatabases, collections, attributes, relationship fields and indexes.
memory::store
Own pageuse utopia_database::adapter::memory::store::array_merge;pub fn array_merge(arrays: &[&Array]) -> ArrayString keys of $b overwrite in place, integer
keys are renumbered after $a's.
use utopia_database::adapter::memory::store::empty;pub fn empty(v: Option<&Value>) -> boolUndocumented.
use utopia_database::adapter::memory::store::for_each_mut;pub fn for_each_mut(a: &mut Array, mut f: impl FnMut(ArrayKey, &mut Value))Undocumented.
use utopia_database::adapter::memory::store::get;pub fn get<'a>(a: &'a Array, path: &[ArrayKey]) -> Option<&'a Value>$a[k1][k2]... (None when a step is missing or not an array).
use utopia_database::adapter::memory::store::get_array;pub fn get_array<'a>(a: &'a Array, path: &[ArrayKey]) -> Option<&'a Array>$a[k1][k2]... as an array (None when missing or not an array).
use utopia_database::adapter::memory::store::isset;pub fn isset(a: &Array, path: &[ArrayKey]) -> boolUndocumented.
use utopia_database::adapter::memory::store::k;pub fn k(s: &str) -> ArrayKeyAn array key from text ($a['key']).
use utopia_database::adapter::memory::store::key_of;pub fn key_of(v: &Value) -> ArrayKeyThe key a value becomes as an array key ($a[$value]): integers stay,
strings are normalized, null is "", booleans and floats integers.
use utopia_database::adapter::memory::store::key_value;pub fn key_value(key: KeyRef<'_>) -> ValueA key as the value foreach ($a as $key => ...) gives.
use utopia_database::adapter::memory::store::push;pub fn push(a: &mut Array, path: &[ArrayKey], value: Value) -> i64$a[k1][k2]...[] = $value: the key it got.
use utopia_database::adapter::memory::store::s;pub fn s(text: &str) -> ValueA string value.
use utopia_database::adapter::memory::store::set;pub fn set(a: &mut Array, path: &[ArrayKey], value: Value)$a[k1][k2]... = $value.
use utopia_database::adapter::memory::store::unset;pub fn unset(a: &mut Array, path: &[ArrayKey])Nothing is created on the way.
use utopia_database::adapter::memory::store::vivify;pub fn vivify<'a>(a: &'a mut Array, path: &[ArrayKey]) -> &'a mut ArrayUndocumented.