index

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 12

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
}

func NewKeySet

func NewKeySet(keys ...Key) KeySet

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

func (KeySet) Foreach

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

Jump to

Keyboard shortcuts

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