Documentation ¶
Index ¶
- Constants
- func IterAll[T codec.ProtoMarshaler](store sdk.KVStore, pu protoUnmarshaler) ([][]byte, []T, error)
- func IterAllFnc[T codec.ProtoMarshaler](store sdk.KVStore, pu protoUnmarshaler, fnc func([]byte, T) bool) error
- func Load[T codec.ProtoMarshaler](store sdk.KVStore, pu protoUnmarshaler, key []byte) (T, error)
- func Save(store sdk.KVStore, pm protoMarshaler, key []byte, val codec.ProtoMarshaler) error
- func Uint64ToByte(n uint64) []byte
- type IDGenerator
- type StoreGetter
- type StoreGetterFn
Constants ¶
View Source
const (
ErrNotFound = whoops.String("item not found in store")
)
Variables ¶
This section is empty.
Functions ¶
func IterAllFnc ¶
func Uint64ToByte ¶
Types ¶
type IDGenerator ¶
type IDGenerator struct {
// contains filtered or unexported fields
}
func NewIDGenerator ¶
func NewIDGenerator(sg StoreGetter, idkey []byte) IDGenerator
NewIDGenerator creates a new ID generator. IT uses idKey as a main
func (IDGenerator) GetLastID ¶
func (i IDGenerator) GetLastID(ctx sdk.Context, name string) uint64
getLastID returns the last id that was inserted for the given name. If one does not exist, then it returns 0,
func (IDGenerator) IncrementNextID ¶
func (i IDGenerator) IncrementNextID(ctx sdk.Context, name string) uint64
incrementNextID returns new ID which can now be used for referencing data and increments the counter internally. It returns the newly inserted ID.
type StoreGetter ¶
func SimpleStoreGetter ¶
func SimpleStoreGetter(s sdk.KVStore) StoreGetter
Click to show internal directories.
Click to hide internal directories.