base

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNow

func GetNow(now FNNow) time.Time

Types

type Collection

type Collection[T Entity, L syncx.RWLocker] struct {
	// contains filtered or unexported fields
}

func NewCollection

func NewCollection[T Entity, L syncx.RWLocker](l L) *Collection[T, L]

func (*Collection[T, L]) Add

func (c *Collection[T, L]) Add(item T) error

func (*Collection[T, L]) Get

func (c *Collection[T, L]) Get(id uint64) (T, bool)

func (*Collection[T, L]) GetItems

func (c *Collection[T, L]) GetItems() []T

func (*Collection[T, L]) Len

func (c *Collection[T, L]) Len() int

func (*Collection[T, L]) Remove

func (c *Collection[T, L]) Remove(item T) error

func (*Collection[T, L]) RemoveByID

func (c *Collection[T, L]) RemoveByID(id uint64) error

func (*Collection[T, L]) Walk

func (c *Collection[T, L]) Walk(callback func(T) error) (err error)

func (*Collection[T, L]) WalkASync

func (c *Collection[T, L]) WalkASync(callback func(T))

type Entity

type Entity interface {
	GetID() uint64
}

type FNNow

type FNNow func() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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