collection

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKVExpression = errors.New(`invalid key-value expression`)
	ErrInvalidKVS          = errors.New("the length of kv must be a even number")
)

Functions

This section is empty.

Types

type AnyType

type AnyType = interface{}

AnyType can be used to hold any type.

type KV

type KV []interface{}

type PlaceholderType

type PlaceholderType = struct{}

PlaceholderType represents a placeholder type.

var Placeholder PlaceholderType

type Set

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

Set is not thread-safe, for concurrent use, make sure to use it with synchronization.

func NewSet

func NewSet() *Set

NewSet returns a managed Set, can only put the values with the same type.

func NewUnmanagedSet

func NewUnmanagedSet() *Set

NewUnmanagedSet returns a unmanaged Set, which can put values with different types.

func (*Set) Add

func (s *Set) Add(i ...interface{})

Add adds i into s.

func (*Set) AddInt

func (s *Set) AddInt(ii ...int)

AddInt adds int values ii into s.

func (*Set) AddInt64

func (s *Set) AddInt64(ii ...int64)

AddInt64 adds int64 values ii into s.

func (*Set) AddStr

func (s *Set) AddStr(ss ...string)

AddStr adds string values ss into s.

func (*Set) AddUint

func (s *Set) AddUint(ii ...uint)

AddUint adds uint values ii into s.

func (*Set) AddUint64

func (s *Set) AddUint64(ii ...uint64)

AddUint64 adds uint64 values ii into s.

func (*Set) Contains

func (s *Set) Contains(i interface{}) bool

Contains checks if i is in s.

func (*Set) Count

func (s *Set) Count() int

Count returns the number of items in s.

func (*Set) Keys

func (s *Set) Keys() []interface{}

Keys returns the keys in s.

func (*Set) KeysInt

func (s *Set) KeysInt() []int

KeysInt returns the int keys in s.

func (*Set) KeysInt64

func (s *Set) KeysInt64() []int64

KeysInt64 returns int64 keys in s.

func (*Set) KeysStr

func (s *Set) KeysStr() []string

KeysStr returns string keys in s.

func (*Set) KeysUint

func (s *Set) KeysUint() []uint

KeysUint returns uint keys in s.

func (*Set) KeysUint64

func (s *Set) KeysUint64() []uint64

KeysUint64 returns uint64 keys in s.

func (*Set) Remove

func (s *Set) Remove(i interface{})

Remove removes i from s.

type SortedMap

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

func New

func New() *SortedMap

func (*SortedMap) Copy

func (m *SortedMap) Copy() *SortedMap

func (*SortedMap) Format

func (m *SortedMap) Format() []string

func (*SortedMap) Get

func (m *SortedMap) Get(key interface{}) (interface{}, bool)

func (*SortedMap) GetOr

func (m *SortedMap) GetOr(key, dft interface{}) interface{}

func (*SortedMap) GetString

func (m *SortedMap) GetString(key interface{}) (string, bool)

func (*SortedMap) GetStringOr

func (m *SortedMap) GetStringOr(key interface{}, dft string) string

func (*SortedMap) HasKey

func (m *SortedMap) HasKey(key interface{}) bool

func (*SortedMap) HasValue

func (m *SortedMap) HasValue(value interface{}) bool

func (*SortedMap) Insert

func (m *SortedMap) Insert(sm *SortedMap)

func (*SortedMap) Keys

func (m *SortedMap) Keys() []interface{}

func (*SortedMap) Range

func (m *SortedMap) Range(iterator func(key, value interface{}))

func (*SortedMap) RangeIf

func (m *SortedMap) RangeIf(iterator func(key, value interface{}) bool)

func (*SortedMap) Remove

func (m *SortedMap) Remove(key interface{}) (value interface{}, ok bool)

func (*SortedMap) Reset

func (m *SortedMap) Reset()

func (*SortedMap) Set

func (m *SortedMap) Set(kv KV) error

func (*SortedMap) SetExpression

func (m *SortedMap) SetExpression(expression string) (key, value interface{}, err error)

func (*SortedMap) SetKV

func (m *SortedMap) SetKV(key, value interface{})

func (*SortedMap) Values

func (m *SortedMap) Values() []interface{}

Jump to

Keyboard shortcuts

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