[−][src]Struct fabric_contract::contract::Collection
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]
T: DataType,
pub fn retrieve<T>(&self, key: &String) -> Result<T, LedgerError> where
T: Default + DataType,
[src]
T: Default + DataType,
pub fn retrieve_hash<T>(&self, key: &String) -> Result<T, LedgerError> where
T: Default + DataType,
[src]
T: Default + DataType,
pub fn update<T>(&self, asset: T) -> Result<State, LedgerError> where
T: DataType,
[src]
T: DataType,
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]
&self,
key: &String
) -> Result<StateHash, LedgerError>
Return the state has ONLY for this key
pub fn create_state(
&self,
key: String,
data: Vec<u8>
) -> Result<State, LedgerError>
[src]
&self,
key: String,
data: Vec<u8>
) -> Result<State, LedgerError>
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]
&self,
key: String,
data: Vec<u8>
) -> Result<State, LedgerError>
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]
&self,
handler: KeyQueryHandler
) -> Result<StateQueryList, LedgerError>
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]
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>,