keeper

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotFound = whoops.Errorf("item (%T) not found in store: %s")
)

Variables

This section is empty.

Functions

func EmitEvent added in v0.6.0

func EmitEvent(k HasModuleName, ctx sdk.Context, name string, attrs ...sdk.Attribute)

func IterAll

func IterAll[T codec.ProtoMarshaler](store sdk.KVStore, pu protoUnmarshaler) ([][]byte, []T, error)

func IterAllFnc

func IterAllFnc[T codec.ProtoMarshaler](store sdk.KVStore, pu protoUnmarshaler, fnc func([]byte, T) bool) error

func IterAllRaw added in v0.6.0

func IterAllRaw(store sdk.KVStore, pu protoUnmarshaler) (keys [][]byte, values [][]byte, _err error)

func Load

func Load[T codec.ProtoMarshaler](store sdk.KVStore, pu protoUnmarshaler, key []byte) (T, error)

func Save

func Save(store sdk.KVStore, pm protoMarshaler, key []byte, val codec.ProtoMarshaler) error

func Uint64ToByte

func Uint64ToByte(n uint64) []byte

Types

type EventAttribute added in v0.6.0

type EventAttribute string

func (EventAttribute) With added in v0.6.0

func (e EventAttribute) With(value string) sdk.Attribute

type HasModuleName added in v0.6.0

type HasModuleName interface {
	ModuleName() string
}

func ModuleNameFunc added in v0.6.0

func ModuleNameFunc(moduleName string) HasModuleName

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.

func (IDGenerator) Zero

func (i IDGenerator) Zero() bool

type StoreGetter

type StoreGetter interface {
	Store(ctx sdk.Context) sdk.KVStore
}

func SimpleStoreGetter

func SimpleStoreGetter(s sdk.KVStore) StoreGetter

type StoreGetterFn

type StoreGetterFn func(ctx sdk.Context) sdk.KVStore

func (StoreGetterFn) Store

func (s StoreGetterFn) Store(ctx sdk.Context) sdk.KVStore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL