Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrSequenceUniqueConstraint = errors.Register("sequence_u256", 1, "sequence already initialized")
)
Functions ¶
func DecodeSequence ¶
func EncodeSequence ¶
Types ¶
type U256 ¶
type U256 struct {
// contains filtered or unexported fields
}
U256 is a persistent unique key generator based on a counter.
func NewSequence256 ¶
func (U256) CurVal ¶
func (s U256) CurVal(store storetypes.KVStore) math.Uint
CurVal returns the last value used. 0 if none.
func (U256) InitVal ¶
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.
func (U256) NextVal ¶
func (s U256) NextVal(store storetypes.KVStore) math.Uint
NextVal increments and persists the counter by one and returns the value.
func (U256) PeekNextVal ¶
func (s U256) PeekNextVal(store storetypes.KVStore) math.Uint
PeekNextVal returns the CurVal + increment step. Not persistent.
Click to show internal directories.
Click to hide internal directories.