utils

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort

func Sort(values []interface{}, comparator comparator.Comparator)

Sort sorts values (in-place) with respect to the given comparator.

Uses Go's sort (hybrid of quicksort for large and then insertion sort for smaller slices).

Types

type SafeList

type SafeList[V any] struct {
	// contains filtered or unexported fields
}

func NewSafeList

func NewSafeList[K any](data ...K) *SafeList[K]

func (*SafeList[V]) Add

func (s *SafeList[V]) Add(value V)

func (*SafeList[V]) Count

func (s *SafeList[V]) Count() int

func (*SafeList[V]) List

func (s *SafeList[V]) List() []V

func (*SafeList[V]) Reset

func (s *SafeList[V]) Reset() []V

type SafeMap

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

func NewSafeMap

func NewSafeMap[K string, V any](data map[K]V) *SafeMap[K, V]

func (*SafeMap[K, V]) Exists

func (s *SafeMap[K, V]) Exists(name K) bool

func (*SafeMap[K, V]) Get

func (s *SafeMap[K, V]) Get(name K) (V, bool)

func (*SafeMap[K, V]) GetMap

func (s *SafeMap[K, V]) GetMap() map[K]V

func (*SafeMap[K, V]) Remove

func (s *SafeMap[K, V]) Remove(name K)

func (*SafeMap[K, V]) Set

func (s *SafeMap[K, V]) Set(name K, value V)

Jump to

Keyboard shortcuts

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