controller

package
v0.0.0-...-54241fc Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func New

func New[K comparable, V any]() *Controller[K, V]

New creates a new controller

func (*Controller[K, V]) Count

func (controller *Controller[K, V]) Count() int

Count returns the amount of entries in the controller

func (*Controller[K, V]) Delete

func (controller *Controller[K, V]) Delete(k K)

func (*Controller[K, V]) Find

func (controller *Controller[K, V]) Find(find func(k K, v V) bool) (v V)

func (*Controller[K, V]) Get

func (controller *Controller[K, V]) Get(k K) V

func (*Controller[K, V]) Get2

func (controller *Controller[K, V]) Get2(k K) (v V, ok bool)

func (*Controller[K, V]) Range

func (controller *Controller[K, V]) Range(f func(K, V) bool) (int, V)

Range iterates over the entries and locks the entry map use return true in an iteration to continue and return false to break it returns the amount of entries iterated and the entry that broke the iteration if exists

func (*Controller[K, V]) RangeNoLock

func (controller *Controller[K, V]) RangeNoLock(f func(K, V) bool) (int, V)

Works the same way as Range but doesn't lock the entry map

func (*Controller[K, V]) Set

func (controller *Controller[K, V]) Set(k K, v V)

Jump to

Keyboard shortcuts

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