util

package
v0.0.0-...-2f30d10 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(s string) string

func IndefiniteArticle

func IndefiniteArticle(word string) string

func IsNil

func IsNil(i any) bool

Types

type Cache

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

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(k K)

func (*Cache[K, V]) Filter

func (c *Cache[K, V]) Filter(filterFunc func(k K, v V) bool) *Cache[K, V]

func (*Cache[K, V]) FilterToStream

func (c *Cache[K, V]) FilterToStream(filterFunc func(k K, v V) bool) stream.Stream[*CachePair[K, V]]

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(k K) (v V, got bool)

func (*Cache[K, V]) GetAndDelete

func (c *Cache[K, V]) GetAndDelete(k K) (v V, ok bool)

func (*Cache[K, V]) GetOrDefault

func (c *Cache[K, V]) GetOrDefault(k K, def V) (v V, got bool)

func (*Cache[K, V]) GetOrNew

func (c *Cache[K, V]) GetOrNew(k K, newFunc func() (V, error)) (v V, err error)

func (*Cache[K, V]) GetOrStore

func (c *Cache[K, V]) GetOrStore(k K, v V) (ov V, got bool)

func (*Cache[K, V]) Range

func (c *Cache[K, V]) Range(rangeFunc func(k K, v V) bool)

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(k K, v V) (oldValue V, ok bool)

func (*Cache[K, V]) Size

func (c *Cache[K, V]) Size() int

func (*Cache[K, V]) ToMap

func (c *Cache[K, V]) ToMap() map[K]V

func (*Cache[K, V]) ToStream

func (c *Cache[K, V]) ToStream() stream.Stream[*CachePair[K, V]]

type CachePair

type CachePair[K comparable, V any] struct {
	K K
	V V
}

type Set

type Set[K comparable] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[K comparable]() *Set[K]

func (*Set[K]) AddValue

func (s *Set[K]) AddValue(v K) bool

func (*Set[K]) Contain

func (s *Set[K]) Contain(v K) bool

func (*Set[K]) DeleteValue

func (s *Set[K]) DeleteValue(v K) bool

func (*Set[K]) DoEach

func (s *Set[K]) DoEach(f func(v K))

func (*Set[K]) DoEachAsync

func (s *Set[K]) DoEachAsync(f func(v K))

func (*Set[K]) Size

func (s *Set[K]) Size() int

type Task

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

func (*Task) Finish

func (t *Task) Finish()

func (*Task) Start

func (t *Task) Start() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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