[][src]Struct fabric_contract::contract::Collection

pub struct Collection { /* fields omitted */ }

Implementations

impl Collection[src]

pub fn new(name: CollectionName) -> Self[src]

pub fn create<T>(&self, asset: T) -> Result<State, LedgerError> where
    T: DataType
[src]

pub fn retrieve<T>(&self, key: &String) -> Result<T, LedgerError> where
    T: Default + DataType
[src]

pub fn retrieve_hash<T>(&self, key: &String) -> Result<T, LedgerError> where
    T: Default + DataType
[src]

pub fn update<T>(&self, asset: T) -> Result<State, LedgerError> where
    T: DataType
[src]

pub fn state_exists(&self, key: &str) -> Result<bool, LedgerError>[src]

Does this key exist

pub fn retrieve_state(&self, key: &String) -> Result<State, LedgerError>[src]

Return the state for this key

pub fn retrieve_state_hash(
    &self,
    key: &String
) -> Result<StateHash, LedgerError>
[src]

Return the state has ONLY for this key

pub fn create_state(
    &self,
    key: String,
    data: Vec<u8>
) -> Result<State, LedgerError>
[src]

Creates the state

If it it already exists, this is an error

pub fn update_state(
    &self,
    key: String,
    data: Vec<u8>
) -> Result<State, LedgerError>
[src]

Update the states

If it doesn't exist, this is an error

pub fn delete_state(&self, key: &String) -> Result<(), LedgerError>[src]

Deletes the key

pub fn get_states(
    &self,
    handler: KeyQueryHandler
) -> Result<StateQueryList, LedgerError>
[src]

Performs a key range query

Example

This example is not tested
use fabric_contract::contract::*;

let collection = Ledger::access_ledger().get_collection(CollectionName::World);
collection.get_states(KeyQueryHandler::Range("Car001","Car002"));

pub fn query_states(&self, handler: RichQueryHandler) -> Result<(), LedgerError>[src]

Rich query support - query is sent to CouchDB

NOT IMPLEMENTED (yet)

Auto Trait Implementations

impl RefUnwindSafe for Collection

impl Send for Collection

impl Sync for Collection

impl Unpin for Collection

impl UnwindSafe for Collection

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.