Documentation
¶
Index ¶
- func MakeKey(keyParts ...string) string
- func SplitKey(key string) []string
- type StateInterface
- type StateList
- func (sl *StateList) AddState(state StateInterface) error
- func (sl *StateList) GetState(key string, state StateInterface) error
- func (sl *StateList) GetStateByPartialCompositeKey(state StateInterface, key ...string) ([]StateInterface, error)
- func (sl *StateList) GetStateByRange(state StateInterface, startKey, endKey string) ([]StateInterface, error)
- func (sl *StateList) UpdateState(state StateInterface) error
- type StateListInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type StateInterface ¶
type StateInterface interface {
// GetSplitKey return components that combine to form the key
GetSplitKey() []string
Serialize() ([]byte, error)
}
StateInterface interface states must implement for use in a list
type StateList ¶
type StateList struct {
Ctx contractapi.TransactionContextInterface
Name string
Deserialize func([]byte, StateInterface) error
}
StateList useful for managing putting data in and out of the ledger. Implementation of StateListInterface
func (*StateList) AddState ¶
func (sl *StateList) AddState(state StateInterface) error
AddState puts state into world state
func (*StateList) GetState ¶
func (sl *StateList) GetState(key string, state StateInterface) error
GetState returns state from world state. Unmarshalls the JSON into passed state. Key is the split key value used in Add/Update joined using a colon
func (*StateList) GetStateByPartialCompositeKey ¶
func (sl *StateList) GetStateByPartialCompositeKey(state StateInterface, key ...string) ([]StateInterface, error)
func (*StateList) GetStateByRange ¶
func (sl *StateList) GetStateByRange(state StateInterface, startKey, endKey string) ([]StateInterface, error)
func (*StateList) UpdateState ¶
func (sl *StateList) UpdateState(state StateInterface) error
UpdateState puts state into world state. Same as AddState but separate as semantically different
type StateListInterface ¶
type StateListInterface interface {
AddState(StateInterface) error
GetState(string, StateInterface) error
UpdateState(StateInterface) error
GetStateByRange(StateInterface, string, string) ([]StateInterface, error)
GetStateByPartialCompositeKey(StateInterface, ...string) ([]StateInterface, error)
}
StateListInterface functions that a state list should have
Click to show internal directories.
Click to hide internal directories.