Documentation
¶
Index ¶
- Variables
- func Delete(stub shim.ChaincodeStubInterface, key interface{}) (err error)
- func Exists(stub shim.ChaincodeStubInterface, key interface{}) (exists bool, err error)
- func Get(stub shim.ChaincodeStubInterface, key interface{}, config ...interface{}) (result interface{}, err error)
- func Insert(stub shim.ChaincodeStubInterface, key interface{}, values ...interface{}) (err error)
- func InvokeChaincode(stub shim.ChaincodeStubInterface, chaincodeName string, args []interface{}, ...) (interface{}, error)
- func Key(stub shim.ChaincodeStubInterface, key interface{}) (string, error)
- func KeyError(strKey string) error
- func KeyFromParts(stub shim.ChaincodeStubInterface, keyParts []string) (string, error)
- func KeyParts(key interface{}) ([]string, error)
- func Put(stub shim.ChaincodeStubInterface, key interface{}, values ...interface{}) (err error)
- type EntryList
- type HistoryEntry
- type HistoryEntryList
- type Keyer
- type KeyerFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnableToCreateKey can occurs while creating composite key for entry ErrUnableToCreateKey = errors.New(`unable to create state key`) // ErrKeyAlreadyExists can occurs when trying to insert entry with existing key ErrKeyAlreadyExists = errors.New(`state key already exists`) // ErrrKeyNotFound key not found in chaincode state ErrKeyNotFound = errors.New(`state entry not found`) // ErrAllowOnlyOneValue can occurs when trying to call Insert or Put with more than 2 arguments ErrAllowOnlyOneValue = errors.New(`allow only one value`) // ErrKeyNotSupportKeyerInterface can occurs when trying to Insert or Put struct without providing key and struct not support Keyer interface ErrKeyNotSupportKeyerInterface = errors.New(`key not support keyer interface`) // ErrKeyPartsLength can occurs when trying to create key consisting of zero parts ErrKeyPartsLength = errors.New(`key parts length must be greater than zero`) )
var (
ErrEmptyChaincodeResponsePayload = errors.New(`empty chaincode response payload`)
)
Functions ¶
func Delete ¶
func Delete(stub shim.ChaincodeStubInterface, key interface{}) (err error)
Delete entry from state
func Exists ¶
func Exists(stub shim.ChaincodeStubInterface, key interface{}) (exists bool, err error)
Exists check entry with key exists in chaincode state
func Get ¶
func Get(stub shim.ChaincodeStubInterface, key interface{}, config ...interface{}) (result interface{}, err error)
Get data by key from state, trying to convert to target interface
func Insert ¶
func Insert(stub shim.ChaincodeStubInterface, key interface{}, values ...interface{}) (err error)
Insert value into chaincode state, returns error if key already exists
func InvokeChaincode ¶
func InvokeChaincode( stub shim.ChaincodeStubInterface, chaincodeName string, args []interface{}, channel string, target interface{}) (interface{}, error)
InvokeChaincode locally calls the specified chaincode and converts result into target data type
func Key ¶
func Key(stub shim.ChaincodeStubInterface, key interface{}) (string, error)
Key transforms interface{} to string key
func KeyFromParts ¶
func KeyFromParts(stub shim.ChaincodeStubInterface, keyParts []string) (string, error)
KeyFromParts creates composite key by string slice
func Put ¶
func Put(stub shim.ChaincodeStubInterface, key interface{}, values ...interface{}) (err error)
Put data value in state with key, trying convert data to []byte
Types ¶
type EntryList ¶
type EntryList []interface{}
EntryList list of entries from state, gotten by part of composite key
type HistoryEntry ¶
type HistoryEntry struct { TxId string `json:"txId"` Timestamp int64 `json:"timestamp"` IsDeleted bool `json:"isDeleted"` Value interface{} `json:"value"` }
HistoryEntry struct containing history information of a single entry
type HistoryEntryList ¶
type HistoryEntryList []HistoryEntry
HistoryEntryList list of history entries
func GetHistory ¶
func GetHistory(stub shim.ChaincodeStubInterface, key interface{}, target interface{}) (result HistoryEntryList, err error)
GetHistory by key from state, trying to convert to target interface
type Keyer ¶
Keyer interface for entity containing logic of its key creation
func StringKeyer ¶
StringKeyer constructor for struct implementing Keyer interface