index

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key []byte

Key is a byte slice describing a key used in an index by statedb.

func Bool

func Bool(b bool) Key

func BoolString added in v0.3.1

func BoolString(s string) (Key, error)

func FromString added in v0.3.1

func FromString(s string) (Key, error)

func Int

func Int(n int) Key

func Int16

func Int16(n int16) Key

func Int16String added in v0.3.1

func Int16String(s string) (Key, error)

func Int32

func Int32(n int32) Key

func Int32String added in v0.3.1

func Int32String(s string) (Key, error)

func Int64

func Int64(n int64) Key

func Int64String added in v0.3.1

func Int64String(s string) (Key, error)

func IntString added in v0.3.1

func IntString(s string) (Key, error)

func NetIP

func NetIP(ip net.IP) Key

func NetIPAddr

func NetIPAddr(addr netip.Addr) Key

func NetIPAddrString added in v0.3.1

func NetIPAddrString(s string) (Key, error)

func NetIPPrefix

func NetIPPrefix(prefix netip.Prefix) Key

func NetIPPrefixString added in v0.3.1

func NetIPPrefixString(s string) (Key, error)

func String

func String(s string) Key

func Stringer

func Stringer[T fmt.Stringer](s T) Key

func Uint16

func Uint16(n uint16) Key

func Uint16String added in v0.3.1

func Uint16String(s string) (Key, error)

func Uint32

func Uint32(n uint32) Key

func Uint32String added in v0.3.1

func Uint32String(s string) (Key, error)

func Uint64

func Uint64(n uint64) Key

func Uint64String added in v0.3.1

func Uint64String(s string) (Key, error)

func (Key) Equal

func (k Key) Equal(k2 Key) bool

type KeySet

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

KeySet is a collection of keys used to index an object. Its zero value is an empty set; a nil key supplied to NewKeySet is a valid zero-length key.

var EmptyKeySet KeySet

EmptyKeySet is a KeySet containing no keys.

func NewKeySet

func NewKeySet(key Key, keys ...Key) KeySet

NewKeySet constructs a non-empty set from keys. Every argument is a key, including a nil or zero-length key.

func Seq added in v0.3.0

func Seq[T any](
	toKey func(T) Key,
	seq iter.Seq[T],
) KeySet

Seq creates a KeySet from an iter.Seq[T] with the given indexing function. Example usage:

var strings iter.Seq[string]
keys := Seq[string](index.String, strings)

func Seq2 added in v0.3.0

func Seq2[A, B any](
	toKey func(A) Key,
	seq iter.Seq2[A, B],
) KeySet

Seq2 creates a KeySet from an iter.Seq2[A,B] with the given indexing function. Example usage:

 var seq iter.Seq2[string, int]
	keys := Seq2(index.String, seq)

func Set

func Set[T any](s part.Set[T]) KeySet

Set creates a KeySet from a part.Set.

func StringMap

func StringMap[V any](m map[string]V) KeySet

func StringSlice

func StringSlice(ss []string) KeySet

func StringerSeq added in v0.3.0

func StringerSeq[T fmt.Stringer](seq iter.Seq[T]) KeySet

func StringerSeq2 added in v0.3.0

func StringerSeq2[A fmt.Stringer, B any](seq iter.Seq2[A, B]) KeySet

func StringerSlice

func StringerSlice[T fmt.Stringer](ss []T) KeySet

func (KeySet) Exists

func (ks KeySet) Exists(k Key) bool

func (KeySet) First

func (ks KeySet) First() (Key, bool)

First returns the first key in the set, or false if the set is empty.

func (KeySet) Foreach

func (ks KeySet) Foreach(fn func(Key))

Foreach calls fn for each key in the set.

func (KeySet) Len added in v0.9.1

func (ks KeySet) Len() int

Len returns the number of keys in the set.

Jump to

Keyboard shortcuts

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