Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(stub shim.ChaincodeStubInterface, elem Asset) error
Create writes a new element
func Exists ¶
func Exists(stub shim.ChaincodeStubInterface, elem Asset) bool
Exists checks whether or not an element exists
func Get ¶
func Get(stub shim.ChaincodeStubInterface, key string, elem Asset) error
Get retrieves an asset's bytes of the same type of elem by key and returns them
func ValidateModel ¶
func ValidateModel(m interface{}) error
ValidateModel validates the fields of a model.
Types ¶
type Asset ¶
type Asset interface {
// GetKey returns the key of this element
GetKey() string
// IsPublic returns whether or not this element gets stored in the public ledger
IsPublic() bool
// Encode returns a byte representation of the element which is the value that we store
Encode() ([]byte, error)
// Decode loads an Asset from a byte array and stores it to the provided interface
Decode([]byte, interface{}) error
}
Asset is an interface for assets that get stored in either private collections or ledger
type PrivateAsset ¶
type PrivateAsset interface {
Asset
// GetCollections returns the private collections to store the PrivateAsset to
GetCollections() []string
}
PrivateAsset extends Asset and is used for assets that get stored in private collections
type PublicAsset ¶
type PublicAsset interface {
Asset
}
PublicAsset extends Asset and is used for assets that get stored in ledger
Click to show internal directories.
Click to hide internal directories.