safe

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewMap added in v0.0.3

func NewMap[K comparable, V any]() *Map[K, V]

func (*Map[K, V]) Del

func (s *Map[K, V]) Del(key K)

func (*Map[K, V]) Get

func (s *Map[K, V]) Get(key K) (V, bool)

func (*Map[K, V]) HasKey

func (s *Map[K, V]) HasKey(key K) bool

func (*Map[K, V]) Len

func (s *Map[K, V]) Len() int

func (*Map[K, V]) Put

func (s *Map[K, V]) Put(key K, value V)

func (*Map[K, V]) Range

func (s *Map[K, V]) Range(cb func(key K, value V))

func (*Map[K, V]) Value

func (s *Map[K, V]) Value() map[K]V

type Number

type Number[T g.Numeric] struct {
	// contains filtered or unexported fields
}

func NewNumber added in v0.0.3

func NewNumber[T g.Numeric](i T) *Number[T]

func (*Number[T]) Add

func (n *Number[T]) Add(val T)

func (*Number[T]) Dec

func (n *Number[T]) Dec()

func (*Number[T]) Divide

func (n *Number[T]) Divide(val T)

func (*Number[T]) Get

func (n *Number[T]) Get() T

func (*Number[T]) Inc

func (n *Number[T]) Inc()

func (*Number[T]) Multiply

func (n *Number[T]) Multiply(val T)

func (*Number[T]) Set

func (n *Number[T]) Set(val T)

func (*Number[T]) Sub

func (n *Number[T]) Sub(val T)

type OrderedMap

type OrderedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

OrderedMap represents an associative array or map abstract data type.

func NewOrderedMap

func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V]

NewOrderedMap creates a new empty OrderedMap.

func (*OrderedMap[K, V]) Data added in v0.1.3

func (m *OrderedMap[K, V]) Data() map[K]V

func (*OrderedMap[K, V]) Empty

func (m *OrderedMap[K, V]) Empty() bool

Empty return if the map in empty or not.

func (*OrderedMap[K, V]) Foreach

func (m *OrderedMap[K, V]) Foreach(callback func(key K, value V) bool)

Foreach iter map.

func (*OrderedMap[K, V]) ForeachR added in v0.1.7

func (m *OrderedMap[K, V]) ForeachR(callback func(key K, value V) bool)

ForeachR iter map only read.

func (*OrderedMap[K, V]) Get

func (m *OrderedMap[K, V]) Get(key K) (value V, ok bool)

Get returns the value of a key from the OrderedMap.

func (*OrderedMap[K, V]) Keys

func (m *OrderedMap[K, V]) Keys() []K

Keys return the keys in the map in insertion order.

func (*OrderedMap[K, V]) Put

func (m *OrderedMap[K, V]) Put(key K, value V)

Put adds items to the map.

If a key is found in the map it replaces it value.

func (*OrderedMap[K, V]) Remove

func (m *OrderedMap[K, V]) Remove(key K)

Remove deletes a key-value pair from the OrderedMap.

If a key is not found in the map it doesn't fails, just does nothing.

func (*OrderedMap[K, V]) Size

func (m *OrderedMap[K, V]) Size() int

Size return the map number of key-value pairs.

func (*OrderedMap[K, V]) String

func (m *OrderedMap[K, V]) String() string

String implements Stringer interface.

Prints the map string representation, a concatenated string of all its string representation values in insertion order.

func (*OrderedMap[K, V]) Values

func (m *OrderedMap[K, V]) Values() []V

Values return the values in the map in insertion order.

type OrderedSet

type OrderedSet[T any] struct {
	// contains filtered or unexported fields
}

OrderedSet represents a dynamic, insertion-ordered, set abstract data type.

func NewOrderedSet

func NewOrderedSet[T comparable]() *OrderedSet[T]

NewOrderedSet creates a new empty OrderedSet.

func (*OrderedSet[T]) Add

func (s *OrderedSet[T]) Add(items ...T)

Add adds items to the set.

If an item is found in the set it replaces it.

func (*OrderedSet[T]) Contains

func (s *OrderedSet[T]) Contains(items ...T) bool

Contains return if set contains the specified items or not.

func (*OrderedSet[T]) Empty

func (s *OrderedSet[T]) Empty() bool

Empty return if the set in empty or not.

func (*OrderedSet[T]) Foreach

func (s *OrderedSet[T]) Foreach(callback func(i int, val T) bool)

Foreach iter set.

func (*OrderedSet[T]) FromList added in v0.0.6

func (s *OrderedSet[T]) FromList(list []T)

FromList converts a list to an OrderedSet.

func (*OrderedSet[T]) MarshalJSON added in v0.0.6

func (s *OrderedSet[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*OrderedSet[T]) Remove

func (s *OrderedSet[T]) Remove(items ...T)

Remove deletes items from the set.

If an item is not found in the set it doesn't fails, just does nothing.

func (*OrderedSet[T]) Size

func (s *OrderedSet[T]) Size() int

Size return the set number of elements.

func (*OrderedSet[T]) String

func (s *OrderedSet[T]) String() string

String implements Stringer interface.

Prints the set string representation, a concatenated string of all its string representation values in insertion order.

func (*OrderedSet[T]) UnmarshalJSON added in v0.0.6

func (s *OrderedSet[T]) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*OrderedSet[T]) Values

func (s *OrderedSet[T]) Values() []T

Values return the set values in insertion order.

type Slice

type Slice[T any] struct {
	// contains filtered or unexported fields
}

func NewSlice added in v0.0.3

func NewSlice[T any]() *Slice[T]

func (*Slice[T]) Add

func (s *Slice[T]) Add(val *T)

Add 添加元素

func (*Slice[T]) Clear

func (s *Slice[T]) Clear()

Clear 删除全部元素

func (*Slice[T]) Get

func (s *Slice[T]) Get(i int) (*T, error)

Get 获去元素

func (*Slice[T]) Iter

func (s *Slice[T]) Iter() []*T

Iter 获得一个迭代体

func (*Slice[T]) Len

func (s *Slice[T]) Len() int

func (*Slice[T]) Pop

func (s *Slice[T]) Pop(i int) error

Pop 删除元素

Jump to

Keyboard shortcuts

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