common

package
v0.0.0-...-3928428 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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"
	// FabricStub is the name of flow property for passing chaincode stub to activities
	FabricStub = "_chaincode_stub"
)

Variables

This section is empty.

Functions

func ConstructQueryResponse

func ConstructQueryResponse(resultsIterator shim.StateQueryIteratorInterface, isCompositeKey bool, stub shim.ChaincodeStubInterface) ([]byte, error)

ConstructQueryResponse iterate through query result to create array of key-value pairs, i.e. JSON string of format [{"key":"mykey", "value":{}}, ...]

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 GetChaincodeStub

func GetChaincodeStub(ctx activity.Context) (shim.ChaincodeStubInterface, error)

GetChaincodeStub returns Fabric chaincode stub from the activity context

func ResolveFlowData

func ResolveFlowData(toResolve string, context activity.Context) (value interface{}, err error)

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 `$flow.content`, which is shown in normal flogo mapper as, e.g., "$flow.content"

func SetChaincodeLogLevel

func SetChaincodeLogLevel(logger *shim.ChaincodeLogger)

SetChaincodeLogLevel sets log level of a chaincode logger according to env 'CORE_CHAINCODE_LOGGING_LEVEL'

Types

type ParameterIndex

type ParameterIndex struct {
	Name     string
	JSONType string
	// contains filtered or unexported fields
}

ParameterIndex stores transaction parameters and its location in raw JSON schema string start and end location is used to sort the parameter list to match the parameter order in schema

func OrderedParameters

func OrderedParameters(schemaData []byte) ([]ParameterIndex, error)

OrderedParameters returns parameters of a JSON schema object sorted by their position in schema definition This is necessary because Golang JSON parser does not maintain the sequence of object parameters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL