Documentation
¶
Index ¶
- Constants
- func DeleteData(stub shim.ChaincodeStubInterface, store string, key string) error
- func ExtractCompositeKeys(stub shim.ChaincodeStubInterface, compositeKeyDefs map[string][]string, ...) []string
- func ExtractDataAttributes(attrs []string, data interface{}) []string
- func GetActivityInputSchema(ctx activity.Context, name string) (string, error)
- func GetActivityOutputSchema(ctx activity.Context, name string) (string, error)
- func GetChaincodeStub(ctx activity.Context) (shim.ChaincodeStubInterface, error)
- func GetCompositeKeys(stub shim.ChaincodeStubInterface, store string, name string, values []string, ...) (shim.StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)
- func GetData(stub shim.ChaincodeStubInterface, store string, key string, privateHash bool) (string, []byte, error)
- func GetDataByQuery(stub shim.ChaincodeStubInterface, store, query string, pageSize int32, ...) (shim.StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)
- func GetDataByRange(stub shim.ChaincodeStubInterface, store, startKey, endKey string, ...) (shim.StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)
- func IsCompositeKey(key string) bool
- func MakeCompositeKey(stub shim.ChaincodeStubInterface, keyName string, attributes []string, ...) (string, bool)
- func MapToObject(data interface{}) (map[string]interface{}, error)
- func PutData(stub shim.ChaincodeStubInterface, store string, key string, value []byte) error
- func ResolveFlowData(toResolve string, context activity.Context) (value interface{}, err error)
- type CompositeKey
- type CompositeKeyBag
Constants ¶
const ( // KeyField attribute used in query response of key-value pairs KeyField = "key" // ValueField attribute used in query response of key-value pairs ValueField = "value" // ValueDeleted marks a deleted Fabric state ValueDeleted = "isDeleted" // FabricStub is the name of flow property for passing chaincode stub to activities FabricStub = "_chaincode_stub" // FabricTxID is the name of flow property for passing auto-generated transaction ID to activities FabricTxID = "txID" // FabricTxTime is the name of flow property for passing auto-generated transaction Time to activities FabricTxTime = "txTime" // FabricCID is the name of flow property for passing client ID to activities FabricCID = "cid" )
Variables ¶
This section is empty.
Functions ¶
func DeleteData ¶
func DeleteData(stub shim.ChaincodeStubInterface, store string, key string) error
DeleteData deletes a state or a composite key from the ledger if 'store' is not specified, or a private data collection specified by 'store'
func ExtractCompositeKeys ¶
func ExtractCompositeKeys(stub shim.ChaincodeStubInterface, compositeKeyDefs map[string][]string, keyValue string, value interface{}) []string
ExtractCompositeKeys collects all valid composite-keys matching composite-key definitions using fields of a value object
func ExtractDataAttributes ¶
ExtractDataAttributes collects values of specified attributes from a data object for constructing a partial composite key
func GetActivityInputSchema ¶
GetActivityInputSchema returns schema of an activity input attribute
func GetActivityOutputSchema ¶
GetActivityOutputSchema returns schema of an activity output attribute
func GetChaincodeStub ¶
func GetChaincodeStub(ctx activity.Context) (shim.ChaincodeStubInterface, error)
GetChaincodeStub returns Fabric chaincode stub from the activity context
func GetCompositeKeys ¶
func GetCompositeKeys(stub shim.ChaincodeStubInterface, store string, name string, values []string, pageSize int32, bookmark string) (shim.StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)
GetCompositeKeys retrieves iterator for composite keys from from the ledger if 'store' is not specified, or a private data collection specified by 'store'
func GetData ¶
func GetData(stub shim.ChaincodeStubInterface, store string, key string, privateHash bool) (string, []byte, error)
GetData retrieves data by state key from the ledger if 'store' is not specified, or a private data collection specified by 'store'
func GetDataByQuery ¶
func GetDataByQuery(stub shim.ChaincodeStubInterface, store, query string, pageSize int32, bookmark string) (shim.StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)
GetDataByQuery retrieves iterator for rich query from from the ledger if 'store' is not specified, or a private data collection specified by 'store'
func GetDataByRange ¶
func GetDataByRange(stub shim.ChaincodeStubInterface, store, startKey, endKey string, pageSize int32, bookmark string) (shim.StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)
GetDataByRange retrieves iterator for range of state keys from from the ledger if 'store' is not specified, or a private data collection specified by 'store'
func IsCompositeKey ¶
IsCompositeKey returns true if a key belongs to composite key namespace
func MakeCompositeKey ¶
func MakeCompositeKey(stub shim.ChaincodeStubInterface, keyName string, attributes []string, keyValue string, value interface{}) (string, bool)
MakeCompositeKey constructs composite key if all specified attributes exist in the value object
attributes contain JsonPath for fields in value objects
returns key, false if key does not include all fields defined in the attributes
func MapToObject ¶
MapToObject strips extra nesting of mapping in config setting of activities exported by OSS Web UI
func PutData ¶
PutData writes key and value to the ledger if 'store' is not specified, or a private data collection specified by 'store'
func ResolveFlowData ¶
ResolveFlowData resolves and returns data from the flow's context, unmarshals JSON string to map[string]interface{}. The name to Resolve is a valid output attribute of a flogo activity, e.g., `activity[app_16].value` or `$.content`, which is shown in normal flogo mapper as, e.g., "$.content"
Types ¶
type CompositeKey ¶
type CompositeKey struct {
Name string `json:"name,omitempty"`
Fields []string `json:"fields"`
Key string `json:"key"`
}
CompositeKey holds components in a composite key
func SplitCompositeKey ¶
func SplitCompositeKey(stub shim.ChaincodeStubInterface, key string) (*CompositeKey, error)
SplitCompositeKey returns components of a composite key
type CompositeKeyBag ¶
type CompositeKeyBag struct {
Name string `json:"name"`
Attributes []string `json:"attributes"`
Keys []*CompositeKey `json:"keys"`
}
CompositeKeyBag holds components in composite keys of the same name
func (*CompositeKeyBag) AddCompositeKey ¶
func (b *CompositeKeyBag) AddCompositeKey(k *CompositeKey) (*CompositeKeyBag, error)
AddCompositeKey adds a new key to the bag
func (*CompositeKeyBag) ToMap ¶
func (b *CompositeKeyBag) ToMap() (map[string]interface{}, error)
ToMap converts CompositeKeyBag to map[string]interface{}