Documentation
¶
Index ¶
- Constants
- Variables
- type Number
- type Sequence
- func (s Sequence[T]) CurVal(store storetypes.KVStore) T
- func (s Sequence[T]) DecodeSequence(bz []byte) T
- func (s Sequence[T]) EncodeSequence(t T) []byte
- func (s Sequence[T]) IncreaseSequence(t T) T
- func (s Sequence[T]) InitVal(store storetypes.KVStore, seq T) error
- func (s Sequence[T]) NextVal(store storetypes.KVStore) T
- func (s Sequence[T]) ToUint32(_ T) uint32
- func (s Sequence[T]) ToUint256(_ T) math.Uint
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 Sequence ¶
type Sequence[T Number] struct { // contains filtered or unexported fields }
func NewSequence ¶
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 (Sequence[T]) EncodeSequence ¶
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
Click to show internal directories.
Click to hide internal directories.