utils

package
v0.1.52 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayN

func ArrayN(n int) []int

func BytesToString

func BytesToString(b []byte) string

func FindRootInterface

func FindRootInterface(v reflect.Value) any

func MakeNew

func MakeNew[T any]() T

func MakeNewAny

func MakeNewAny(v any) any

func MakeValue

func MakeValue(elem reflect.Type) reflect.Value

func StringToBytes

func StringToBytes(s string) []byte

Types

type PreAllocatedPool

type PreAllocatedPool[T any] struct {
	*SyncPoolWrapper[T]
	// contains filtered or unexported fields
}

func NewPreAllocatedPool

func NewPreAllocatedPool[T any](newFunc func() any, size int) *PreAllocatedPool[T]

func (*PreAllocatedPool[T]) Get

func (s *PreAllocatedPool[T]) Get() T

func (*PreAllocatedPool[T]) Put

func (s *PreAllocatedPool[T]) Put(t T)

type SortShim

type SortShim struct {
	SwapFn func(i, j int)
	Length int
	LessFn func(i, j int) bool
}

func (*SortShim) Len

func (s *SortShim) Len() int

func (*SortShim) Less

func (s *SortShim) Less(i, j int) bool

func (*SortShim) Swap

func (s *SortShim) Swap(i, j int)

type SyncPool

type SyncPool[T any] interface {
	Get() T
	Put(T)
}

type SyncPoolWrapper

type SyncPoolWrapper[T any] struct {
	sync.Pool
}

func (*SyncPoolWrapper[T]) Get

func (s *SyncPoolWrapper[T]) Get() T

func (*SyncPoolWrapper[T]) Put

func (s *SyncPoolWrapper[T]) Put(t T)

Jump to

Keyboard shortcuts

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