Documentation
¶
Index ¶
- func ConvertTo[V any, R any](source Enumerable[V], convert func(V) R) []R
- func ConvertToWithIndex[V any, R any](source Enumerable[V], convert func(int, V) R) []R
- func ConvertToWithKey[K comparable, V any, R any](source EnumerableWithKey[K, V], convert func(K, V) R) []R
- type Array
- type Container
- type Enumerable
- type Enumerable2
- type EnumerableWithKey
- type GoMap
- type LinkedList
- func (list *LinkedList[T]) Add(values ...T)
- func (list *LinkedList[T]) Each(f func(index int, value T))
- func (list *LinkedList[T]) Empty() bool
- func (list *LinkedList[T]) Every(f func(index int, value T) bool) bool
- func (list *LinkedList[T]) Get(index int) (T, bool)
- func (list *LinkedList[T]) IndexOf(value T) int
- func (list *LinkedList[T]) Range(f func(index int, value T) bool)
- func (list *LinkedList[T]) Remove(index int)
- func (list *LinkedList[T]) RemoveAll()
- func (list *LinkedList[T]) ReverseRange(f func(index int, value T) bool)
- func (list *LinkedList[T]) Set(index int, v T)
- func (list *LinkedList[T]) Size() int
- func (list *LinkedList[T]) Some(f func(index int, value T) bool) bool
- func (list *LinkedList[T]) Values() []T
- type Map
- type RWMutexMap
- func (m *RWMutexMap[K, V]) Data() map[K]V
- func (m *RWMutexMap[K, V]) Delete(key K)
- func (m *RWMutexMap[K, V]) DeleteAll()
- func (m *RWMutexMap[K, V]) Each(f func(key K, value V))
- func (m *RWMutexMap[K, V]) EachValue(f func(value V))
- func (m *RWMutexMap[K, V]) Exist(key K) (ok bool)
- func (m *RWMutexMap[K, V]) Get(key K) V
- func (m *RWMutexMap[K, V]) Keys() []K
- func (m *RWMutexMap[K, V]) Load(key K) (value V, ok bool)
- func (m *RWMutexMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)
- func (m *RWMutexMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)
- func (m *RWMutexMap[K, V]) Range(f func(key K, value V) bool)
- func (m *RWMutexMap[K, V]) Size() int
- func (m *RWMutexMap[K, V]) Store(key K, value V)
- func (m *RWMutexMap[K, V]) Values() []V
- type RWSlice
- func (rw RWSlice[V]) Add(src ...V)
- func (rw RWSlice[V]) Capacity() int
- func (rw RWSlice[V]) Data() []V
- func (rw RWSlice[V]) Each(f func(index int, value V))
- func (rw RWSlice[V]) Get(index int) V
- func (rw RWSlice[V]) Length() int
- func (rw RWSlice[V]) Range(f func(index int, value V) bool)
- func (rw RWSlice[V]) Remove(index int)
- func (rw RWSlice[V]) Set(index int, v V)
- type SafeArray
- type SafeMap
- type Sizer
- type SyncMap
- func (s *SyncMap[K, V]) Data() map[K]V
- func (s *SyncMap[K, V]) Delete(key K)
- func (s *SyncMap[K, V]) DeleteAll()
- func (s *SyncMap[K, V]) Each(f func(key K, value V))
- func (s *SyncMap[K, V]) EachValue(f func(value V))
- func (s *SyncMap[K, V]) Exist(key K) (ok bool)
- func (s *SyncMap[K, V]) Get(key K) V
- func (s *SyncMap[K, V]) Keys() []K
- func (s *SyncMap[K, V]) Load(key K) (value V, ok bool)
- func (s *SyncMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)
- func (s *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)
- func (s *SyncMap[K, V]) Range(f func(key K, value V) bool)
- func (s *SyncMap[K, V]) Size() int
- func (s *SyncMap[K, V]) Store(key K, value V)
- func (s *SyncMap[K, V]) Values() []V
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertTo ¶
func ConvertTo[V any, R any](source Enumerable[V], convert func(V) R) []R
Example ¶
data := map[string]int{}
data["a"] = 1
data["b"] = 2
data["c"] = 3
r := ConvertTo[int](GoMap[string, int](data), func(v int) string {
return strconv.Itoa(v)
})
fmt.Println(r)
Output: [1 2 3]
func ConvertToWithIndex ¶
func ConvertToWithIndex[V any, R any](source Enumerable[V], convert func(int, V) R) []R
func ConvertToWithKey ¶
func ConvertToWithKey[K comparable, V any, R any](source EnumerableWithKey[K, V], convert func(K, V) R) []R
Types ¶
type Enumerable ¶
type Enumerable2 ¶ added in v0.0.3
type Enumerable2[K any, V any] interface { // Each calls the given function once for each element, passing that element's index(or key) and value. Each(f func(index K, value V)) // Range passes each element of the list to the given function and // break loop if the function returns false. Range(f func(index K, value V) bool) // Every passes each element of the list to the given function and // returns true if the function returns true for all elements. Every(f func(index K, value V) bool) bool // Some passes each element of the container to the given function and // returns true if the function ever returns true for any element. Some(f func(index K, value V) bool) bool }
type EnumerableWithKey ¶
type EnumerableWithKey[K comparable, V any] interface { Sizer Each(func(key K, value V)) }
type GoMap ¶
type GoMap[K comparable, V any] map[K]V
type LinkedList ¶ added in v0.0.3
type LinkedList[T comparable] struct { // contains filtered or unexported fields }
func NewLinkedList ¶ added in v0.0.3
func NewLinkedList[T comparable](values ...T) *LinkedList[T]
func (*LinkedList[T]) Add ¶ added in v0.0.3
func (list *LinkedList[T]) Add(values ...T)
func (*LinkedList[T]) Each ¶ added in v0.0.3
func (list *LinkedList[T]) Each(f func(index int, value T))
func (*LinkedList[T]) Empty ¶ added in v0.0.3
func (list *LinkedList[T]) Empty() bool
func (*LinkedList[T]) Every ¶ added in v0.0.3
func (list *LinkedList[T]) Every(f func(index int, value T) bool) bool
func (*LinkedList[T]) Get ¶ added in v0.0.3
func (list *LinkedList[T]) Get(index int) (T, bool)
func (*LinkedList[T]) IndexOf ¶ added in v0.0.3
func (list *LinkedList[T]) IndexOf(value T) int
func (*LinkedList[T]) Range ¶ added in v0.0.3
func (list *LinkedList[T]) Range(f func(index int, value T) bool)
func (*LinkedList[T]) Remove ¶ added in v0.0.3
func (list *LinkedList[T]) Remove(index int)
func (*LinkedList[T]) RemoveAll ¶ added in v0.0.3
func (list *LinkedList[T]) RemoveAll()
func (*LinkedList[T]) ReverseRange ¶ added in v0.0.3
func (list *LinkedList[T]) ReverseRange(f func(index int, value T) bool)
func (*LinkedList[T]) Set ¶ added in v0.0.3
func (list *LinkedList[T]) Set(index int, v T)
func (*LinkedList[T]) Size ¶ added in v0.0.3
func (list *LinkedList[T]) Size() int
func (*LinkedList[T]) Some ¶ added in v0.0.3
func (list *LinkedList[T]) Some(f func(index int, value T) bool) bool
func (*LinkedList[T]) Values ¶ added in v0.0.3
func (list *LinkedList[T]) Values() []T
type RWMutexMap ¶
type RWMutexMap[K constraints.Basic, V any] struct { // contains filtered or unexported fields }
RWMutexMap implements the SafeMap[K,V] interface
func NewRWMutexMap ¶
func NewRWMutexMap[K constraints.Basic, V any]() *RWMutexMap[K, V]
func (*RWMutexMap[K, V]) Data ¶
func (m *RWMutexMap[K, V]) Data() map[K]V
func (*RWMutexMap[K, V]) Delete ¶
func (m *RWMutexMap[K, V]) Delete(key K)
func (*RWMutexMap[K, V]) DeleteAll ¶
func (m *RWMutexMap[K, V]) DeleteAll()
func (*RWMutexMap[K, V]) Each ¶
func (m *RWMutexMap[K, V]) Each(f func(key K, value V))
func (*RWMutexMap[K, V]) EachValue ¶
func (m *RWMutexMap[K, V]) EachValue(f func(value V))
func (*RWMutexMap[K, V]) Exist ¶
func (m *RWMutexMap[K, V]) Exist(key K) (ok bool)
func (*RWMutexMap[K, V]) Get ¶
func (m *RWMutexMap[K, V]) Get(key K) V
func (*RWMutexMap[K, V]) Keys ¶
func (m *RWMutexMap[K, V]) Keys() []K
func (*RWMutexMap[K, V]) Load ¶
func (m *RWMutexMap[K, V]) Load(key K) (value V, ok bool)
func (*RWMutexMap[K, V]) LoadAndDelete ¶
func (m *RWMutexMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)
func (*RWMutexMap[K, V]) LoadOrStore ¶
func (m *RWMutexMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)
func (*RWMutexMap[K, V]) Range ¶
func (m *RWMutexMap[K, V]) Range(f func(key K, value V) bool)
func (*RWMutexMap[K, V]) Size ¶
func (m *RWMutexMap[K, V]) Size() int
func (*RWMutexMap[K, V]) Store ¶
func (m *RWMutexMap[K, V]) Store(key K, value V)
func (*RWMutexMap[K, V]) Values ¶
func (m *RWMutexMap[K, V]) Values() []V
type RWSlice ¶ added in v0.0.3
type RWSlice[V any] struct { // contains filtered or unexported fields }
func NewRWSlice ¶ added in v0.0.3
type SyncMap ¶
type SyncMap[K constraints.Basic, V any] struct { // contains filtered or unexported fields }
SyncMap efficiency is lower than the sync.Map, only suitable for small maps
func NewSyncMap ¶
func NewSyncMap[K constraints.Basic, V any]() *SyncMap[K, V]
func (*SyncMap[K, V]) LoadAndDelete ¶
func (*SyncMap[K, V]) LoadOrStore ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package geom implements a basic 2-D geometry library.
|
Package geom implements a basic 2-D geometry library. |
Click to show internal directories.
Click to hide internal directories.