# Packages
No description provided by the author
# Functions
AddComplianceRule allows a class to register a custom algorithm that calculates whether this state is compliant.
AddRoute allows a class definition to register its payload API, one route at a time functionName is the function that will appear in a rest or gRPC message method is one of deploy, invoke or query class is the asset class that created the route function is the actual function to be executed when the router is triggered.
AddRule allows a class register its rules, one at a time.
AddToStringArray merges a specified object (usually in asset state) by qualified name with an incoming string or string array.
AsMap does its best to interpret or cast the incoming generic to map[string]interface{}.
AsStringArray does its best to interpret or cast to []string.
CanCreateOnFirstUpdate retrieves the setting from the ledger and returns it to the calling function.
ClearAlert removes an alertname from the active alerts array.
ClearRecentStates resets recent states to an empty array.
Contains checks every element with a deepEqual.
DeepCopyMap will create a new physical copy.
DeepMergeMap all levels of a src map into a dst map and return dst.
Deg converts from radians to degrees.
Distance returns distance between geo coordinates in degrees, result is km translated from groovy on rosettacode.com.
GetAlertsAndDeltas takes two alert name arrays and returns a map with "raised" and "cleared" lists.
GetAssetFromLedger accepts an assetKey and returns an Asset structure.
GETContractStateFromLedger retrieves state from ledger and returns to caller.
GetObject finds an object by its qualified name, which looks like "location.latitude" as one example.
GetObjectAsBoolean retrieves an object by qualified name and interprets or casts it to bool.
GetObjectAsInteger retrieves an object by qualified name and interprets or casts it to integer NOTE: will truncate in incoming JSON Number (float64).
GetObjectAsMap retrieves an object by qualified name and then runs AsMap on it to interpret or cast it to map[string]interface{}.
GetObjectAsNumber retrieves an object by qualified name and interprets or casts it to float64.
GetObjectAsString retrieves an object by qualified name and interprets or casts it to string.
GetObjectAsStringArray retrieves an object by qualified name and interprets or casts it to []string.
GETRecentStatesFromLedger returns the unmarshaled recent states.
Init is called by deploy messages.
InitializeContractState sets version and nickname back to defaults.
Invoke is called when an invoke message is received.
PrettyPrint returns a string that is a nicely indented representation of js object (map); if json fails for some reason, returns the %#v representation.
PUTContractStateToLedger writes a contract state into the ledger.
PUTcreateOnFirstUpdate marshals the new setting and writes it to the ledger.
PutObject inserts an object by its qualified name, which looks like "location.latitude" as one example.
PUTRecentStatesToLedger marshals and writes the recent states.
Query is called when a query message is received.
Rad converts from degrees to radians.
RaiseAlert adds an alertname to the active alerts array.
RegisterDefaultRoutes registers the basic crud API for the simplest possible contract.
RemoveFromStringArray removes from a named object in asset state or other map, an incoming string or string array.
RemoveObject removes an object by its qualified name, which looks like "location.latitude" as one example.
SetContractLogger allows the whole package to be loaded at startup and to share a single chaincode logger.
# Constants
CONTRACTSTATEKEY is used to store contract state, including version, nickname and activeAssets.
CREATEONFIRSTUPDATEKEY is used to store can create on update status, which if true by default.
EVTCCINVRESULT is a chaincode event ID to be emitted always at the end of an invoke The platform defines this as an event with a payload that is an array of objects that can be added to along the way.
MatchAll requires that every property in the filter be present and have the same value.
MatchAny requires that at least one property in the filter be present and have the same value.
MatchDisabled causes the filter to not execute.
MatchNone requires that every property in the filter either be present and have a different value.
MaxRecentStates is an arbitrary limit on how many asset states we track across the entire contract.
RECENTSTATESKEY is used as key for recent states bucket.
+ assetKey + '.' + txnts.
# Variables
AllAssetClass is the class of all assets.
DefaultClass is useful for the minimal contract with a single class.
EmptyDateRange is used to determine that a range does not exist, which works in this case because the zero values of time are nonsense.
MatchName is a map of ID to name.
MatchValue is a map of name to ID.
SystemClass acts as the class of all containers.
# Structs
Asset is a type that holds all information about an asset, including its name, its world state prefix, and the qualified property name that is its assetID.
AssetClass defines a receiver for rules and other class-specific execution.
AssetStateHistory is used to hold the output array of strings.
ChaincodeRoute stores a route for an asset class or event.
ContractState struct defines contract state.
CreateOnFirstUpdate is a shared parameter structure for the use of the createonupdate feature.
DateRange allows a function to return states between a begin and end time, inclusive.
InvokeResultEvent carries the event that is to be set upon exit from the chaincode.
QPropNV is a name : value pair to be matched.
RecentStates in world state.
Rule stores a route for an asset class or event.
SimpleChaincode is the receiver for all shim API.
StateFilter is a complete filter for a state.
TaggedFilter is a complete filter for a state, inside a "filter" object".
# Type aliases
AlertName is a string that represents an alert.
AlertNameArray is a string that represents an alert.
AssetArray is an array of assets, used by read all, recent states, history, etc.
ByTimestamp alias for sorting by timestamp.
ChaincodeFunc is the signature for all functions that eminate from deploy, invoke or query messages to the contract.
MatchType denotes how a filter should operate.
RecentStatesOut is query output format.
RuleFunc is the signature for all rule functions.