MultiIndex

new


#![allow(unused)]
fn main() {
pub fn new(code: Name, scope: Name, table: Name, indexes: &[SecondaryType]) -> Self
}

set


#![allow(unused)]
fn main() {
pub fn set(&self, key: u64, value: &T, payer: Name) -> Iterator<T>
}

store


#![allow(unused)]
fn main() {
pub fn store(&self, value: &T, payer: Name) -> Iterator<T>
}

Store a value index by primary_key of value. payer specifies account to pay the RAM resources. Code execution fails if there is already a value with primary_key in the database. store method calls value.get_primary() to get primary key


#![allow(unused)]
fn main() {
let it = db.find(key);
if !it.is_ok() {
    //create a new value
    //let value = ...
    db.store(&value, payer);
} else {
    let mut value = it.get_value();
    // modify value
    // ...
    db.update(it, &value, payer);
}
}

update


#![allow(unused)]
fn main() {
pub fn update(&self, iterator: &Iterator<T>, value: &T, payer: Name)
}

Update a value in database. payer specifies account to pay the RAM resources. The related action in transaction must contain a corresponding permission of payer.

remove


#![allow(unused)]
fn main() {
pub fn remove(&self, iterator: &Iterator<T>)
}

get


#![allow(unused)]
fn main() {
pub fn get(&self, iterator: &Iterator<T>) -> Option<T>
}

get_by_primary


#![allow(unused)]
fn main() {
pub fn get_by_primary(&self, primary: u64) -> Option<T>
}

next


#![allow(unused)]
fn main() {
pub fn next(&self, iterator: &Iterator<T>) -> Iterator<T>
}

previous


#![allow(unused)]
fn main() {
pub fn previous(&self, iterator: &Iterator<T>) -> Iterator<T>
}

find


#![allow(unused)]
fn main() {
pub fn find(&self, id: u64) -> Iterator<T>
}

lowerbound


#![allow(unused)]
fn main() {
pub fn lowerbound(&self, id: u64) -> Iterator<T>
}

upperbound


#![allow(unused)]
fn main() {
pub fn upperbound(&self, id: u64) -> Iterator<T>
}

end


#![allow(unused)]
fn main() {
pub fn end(&self) -> Iterator<T>
}

get_idx_db


#![allow(unused)]
fn main() {
pub fn get_idx_db(&self, i: usize) -> &dyn IndexDB
}

idx_update


#![allow(unused)]
fn main() {
pub fn idx_update(&self, it: SecondaryIterator, value: SecondaryValue, payer: Name)
}

Source Code

mi.rs