[][src]Trait eosio_cdt::TableIndex

pub trait TableIndex<'a, K, T> where
    T: Table + 'a, 
{ type Cursor: TableCursor<T> + 'a; fn code(&'a self) -> AccountName;
fn scope(&'a self) -> ScopeName;
fn lower_bound<N: Into<K>>(&'a self, key: N) -> Option<Self::Cursor>;
fn upper_bound<N: Into<K>>(&'a self, key: N) -> Option<Self::Cursor>;
fn emplace<I: Borrow<T::Row>>(
        &'a self,
        payer: AccountName,
        item: I
    ) -> Result<(), WriteError>;
fn find<N: Into<K>>(&'a self, key: N) -> Option<Self::Cursor>; fn exists<N: Into<K>>(&'a self, key: N) -> bool { ... } }

Table index

Associated Types

type Cursor: TableCursor<T> + 'a

The kind of cursor this table index uses

Loading content...

Required methods

fn code(&'a self) -> AccountName

Returns the account name of the smart contract

fn scope(&'a self) -> ScopeName

Returns the table scope

fn lower_bound<N: Into<K>>(&'a self, key: N) -> Option<Self::Cursor>

Returns a cursor pointing to the first row that matches a key

fn upper_bound<N: Into<K>>(&'a self, key: N) -> Option<Self::Cursor>

Returns a cursor pointing to the last row that matches a key

fn emplace<I: Borrow<T::Row>>(
    &'a self,
    payer: AccountName,
    item: I
) -> Result<(), WriteError>

Inserts a new row into the table

Errors

Will return Err if there was an issue serializing the value.

fn find<N: Into<K>>(&'a self, key: N) -> Option<Self::Cursor>

Loading content...

Provided methods

fn exists<N: Into<K>>(&'a self, key: N) -> bool

Returns true if the table contains a row with the specified primary key

Loading content...

Implementations on Foreign Types

impl<'a, T> TableIndex<'a, u64, T> for PrimaryTableIndex<T> where
    T: Table + 'a, 
[src]

type Cursor = PrimaryTableCursor<T>

fn find<Id>(&'a self, id: Id) -> Option<PrimaryTableCursor<T>> where
    Id: Into<u64>, 
[src]

Returns a cursor pointing to a row with the specified primary key, if it exists

impl<'a, K, T> TableIndex<'a, K, T> for SecondaryTableIndex<K, T> where
    K: IntoNativeSecondaryKey + 'a,
    T: Table + 'a, 
[src]

type Cursor = SecondaryTableCursor<'a, K, T>

Loading content...

Implementors

Loading content...