cosmos-sdk: github.com/cosmos/cosmos-sdk/store/list Index | Files

package list

import "github.com/cosmos/cosmos-sdk/store/list"

Index

Package Files

list.go

func ElemKey Uses

func ElemKey(index uint64) []byte

Key for the elements of the list

func LengthKey Uses

func LengthKey() []byte

Key for the length of the list

type List Uses

type List struct {
    // contains filtered or unexported fields
}

List defines an integer indexable mapper It panics when the element type cannot be (un/)marshalled by the codec

func NewList Uses

func NewList(cdc *codec.Codec, store types.KVStore) List

NewList constructs new List

func (List) Delete Uses

func (m List) Delete(index uint64)

Delete() deletes the element in the given position Other elements' indices are preserved after deletion Panics when the index is out of range

func (List) Get Uses

func (m List) Get(index uint64, ptr interface{}) error

Get() returns the element by its index

func (List) Iterate Uses

func (m List) Iterate(ptr interface{}, fn func(uint64) bool)

CONTRACT: No writes may happen within a domain while iterating over it.

func (List) Len Uses

func (m List) Len() (res uint64)

Len() returns the length of the list The length is only increased by Push() and not decreased List dosen't check if an index is in bounds The user should check Len() before doing any actions

func (List) Push Uses

func (m List) Push(value interface{})

Push() inserts the element to the end of the list It will increase the length when it is called

func (List) Set Uses

func (m List) Set(index uint64, value interface{})

Set() stores the element to the given position Setting element out of range will break length counting Use Push() instead of Set() to append a new element

Package list imports 4 packages (graph). Updated 2019-10-18. Refresh now. Tools for package owners.