lib

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDir

func AppDir() string

func AppName

func AppName() string

func HasIntersection

func HasIntersection[T comparable](aa []T, bb []T) bool

func Intersection

func Intersection[T comparable](aa []T, bb []T) []T

func NewFileInfo

func NewFileInfo(name string, size int64, mode fs.FileMode, modTime time.Time, isDir bool) fs.FileInfo

func NewVConn added in v0.0.5

func NewVConn() (*VConn, *VConn)

func RandomString

func RandomString(lenNum int) string

func Union

func Union[T comparable](aa []T, bb []T) []T

Types

type ExpireCache

type ExpireCache struct {
	Timeout int64
	// contains filtered or unexported fields
}

func (*ExpireCache) Delete

func (c *ExpireCache) Delete(key string)

func (*ExpireCache) Load

func (c *ExpireCache) Load(key string) (any, bool)

func (*ExpireCache) Store

func (c *ExpireCache) Store(key string, value any)
type LinkList[T any] struct {
	// contains filtered or unexported fields
}

func (*LinkList[T]) Add

func (l *LinkList[T]) Add(v T, num int)

func (*LinkList[T]) Dequeue

func (l *LinkList[T]) Dequeue()

func (*LinkList[T]) Enqueue

func (l *LinkList[T]) Enqueue(v T)

func (*LinkList[T]) Get

func (l *LinkList[T]) Get(index int) T

func (*LinkList[T]) GetAll

func (l *LinkList[T]) GetAll() []T

func (*LinkList[T]) Pop

func (l *LinkList[T]) Pop()

func (*LinkList[T]) Push

func (l *LinkList[T]) Push(v T)

func (*LinkList[T]) Remove

func (l *LinkList[T]) Remove(index int)

func (*LinkList[T]) Size

func (l *LinkList[T]) Size() int

func (*LinkList[T]) Walk

func (l *LinkList[T]) Walk(fn func(v T) bool)

type Map

type Map[T any] struct {
	// contains filtered or unexported fields
}

func (*Map[T]) Clear

func (c *Map[T]) Clear()

func (*Map[T]) Delete

func (c *Map[T]) Delete(name string)

func (*Map[T]) DeleteDirectly

func (c *Map[T]) DeleteDirectly(name string)

func (*Map[T]) Len

func (c *Map[T]) Len() int

func (*Map[T]) Load

func (c *Map[T]) Load(name string) *T

func (*Map[T]) LoadAndDelete

func (c *Map[T]) LoadAndDelete(name string) *T

func (*Map[T]) LoadAndStore

func (c *Map[T]) LoadAndStore(name string, value *T) *T

func (*Map[T]) Map

func (c *Map[T]) Map() map[string]*T

func (*Map[T]) Range

func (c *Map[T]) Range(iterator func(name string, item *T) bool)

func (*Map[T]) Store

func (c *Map[T]) Store(name string, value *T)

type Options

type Options map[string]any

func (Options) Bool

func (o Options) Bool(name string, def bool) bool

func (Options) Float64

func (o Options) Float64(name string, def float64) float64

func (Options) Int

func (o Options) Int(name string, def int) int

func (Options) Int64

func (o Options) Int64(name string, def int64) int64

type Pool

type Pool[T any] struct {
	Init int
	Cap  int
	Idle int
	New  func() T
	// contains filtered or unexported fields
}

func (*Pool[T]) Obtain

func (p *Pool[T]) Obtain(fn func()) T

type RingBuffer

type RingBuffer[T any] struct {
	Size   int32
	Reader int32
	Writer int32
	Buffer []T
}

func NewRingBuffer

func NewRingBuffer[T any](size int) *RingBuffer[T]

func (*RingBuffer[T]) Latest

func (r *RingBuffer[T]) Latest() T

func (*RingBuffer[T]) Oldest

func (r *RingBuffer[T]) Oldest() T

func (*RingBuffer[T]) Overwrite

func (r *RingBuffer[T]) Overwrite(v T)

func (*RingBuffer[T]) Read

func (r *RingBuffer[T]) Read() T

func (*RingBuffer[T]) Write

func (r *RingBuffer[T]) Write(value T)

type VConn added in v0.0.5

type VConn struct {
	*io.PipeReader
	*io.PipeWriter
}

func (*VConn) Close added in v0.0.5

func (c *VConn) Close() error

func (*VConn) LocalAddr added in v0.0.5

func (c *VConn) LocalAddr() net.Addr

func (*VConn) RemoteAddr added in v0.0.5

func (c *VConn) RemoteAddr() net.Addr

func (*VConn) SetDeadline added in v0.0.5

func (c *VConn) SetDeadline(t time.Time) error

func (*VConn) SetReadDeadline added in v0.0.5

func (c *VConn) SetReadDeadline(t time.Time) error

func (*VConn) SetWriteDeadline added in v0.0.5

func (c *VConn) SetWriteDeadline(t time.Time) error

type Values

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

func (*Values) Clear

func (p *Values) Clear()

func (*Values) Get

func (p *Values) Get(id string) any

func (*Values) GetAll

func (p *Values) GetAll() any

func (*Values) Merge

func (p *Values) Merge(props map[string]any)

func (*Values) Put

func (p *Values) Put(id string, val any)

Jump to

Keyboard shortcuts

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