fabric-samples/commercial-paper/organization/digibank/contract-go/ledger-api/state.go
Andrew Hurt 5b93dd0cc0 [FAB-17140] Add go commercial paper contract (#102)
Signed-off-by: Andrew Hurt <andrew.hurt1@ibm.com>
2020-01-24 14:12:30 +00:00

27 lines
536 B
Go

/*
* SPDX-License-Identifier: Apache-2.0
*/
package ledgerapi
import (
"strings"
)
// SplitKey splits a key on colon
func SplitKey(key string) []string {
return strings.Split(key, ":")
}
// MakeKey joins key parts using colon
func MakeKey(keyParts ...string) string {
return strings.Join(keyParts, ":")
}
// StateInterface interface states must implement
// for use in a list
type StateInterface interface {
// GetSplitKey return components that combine to form the key
GetSplitKey() []string
Serialize() ([]byte, error)
}