sequence

package
v2.0.0-...-cd6b821 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const EncodedSeqLength = 4

Variables

View Source
var ErrSequenceUniqueConstraint = errors.Register("sequence_u256", 1, "sequence already initialized")

Functions

This section is empty.

Types

type Number

type Number interface {
	uint32 | math.Uint
}

type Sequence

type Sequence[T Number] struct {
	// contains filtered or unexported fields
}

func NewSequence

func NewSequence[T Number](prefix []byte) Sequence[T]

func (Sequence[T]) CurVal

func (s Sequence[T]) CurVal(store storetypes.KVStore) T

CurVal returns the last value used. 0 if none.

func (Sequence[T]) DecodeSequence

func (s Sequence[T]) DecodeSequence(bz []byte) T

func (Sequence[T]) EncodeSequence

func (s Sequence[T]) EncodeSequence(t T) []byte

func (Sequence[T]) IncreaseSequence

func (s Sequence[T]) IncreaseSequence(t T) T

func (Sequence[T]) InitVal

func (s Sequence[T]) InitVal(store storetypes.KVStore, seq T) error

InitVal this function sets the starting value for a sequence and can only be called once on an empty database. If the key already exists, an error will be returned. The provided start value will be stored as the current value. It is advised to use this function only when the sequence start value is not '1', as calling it unnecessarily will consume unnecessary gas. An example scenario would be importing from genesis. WARNING: only for test now

func (Sequence[T]) NextVal

func (s Sequence[T]) NextVal(store storetypes.KVStore) T

func (Sequence[T]) ToUint32

func (s Sequence[T]) ToUint32(_ T) uint32

func (Sequence[T]) ToUint256

func (s Sequence[T]) ToUint256(_ T) math.Uint

Jump to

Keyboard shortcuts

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