Documentation ¶
Index ¶
- Constants
- func Abs[T Number](n T) T
- func Clamp[T Number](value, min, max T) T
- func CompileJSONWithComment(src []byte) []byte
- func IndexOf[T Comparable](arr []T, target T) int
- func IsSameDay(t1, t2 time.Time) bool
- func Max[T Number](a, b T) T
- func MidnightTime() time.Time
- func MidnightTimeBy(now time.Time) time.Time
- func Min[T Number](a, b T) T
- func RandomFromArray[T any](arr []T) T
- func RandomInt(low int, high int) int
- func RandomString(len int) string
- func RemoveByIdx[T Comparable](arr *[]T, i int)
- func ShuffleArray[T any](arr []T)
- func ToJson(v any) string
- func TryRemoveByValue[T Comparable](arr *[]T, v T) int
- func UnmarshalJsonFileWithComment(file string, p interface{}) error
- func UnmarshalJsonWithComment(content []byte, p interface{}) error
- type ActiveMap
- func (m *ActiveMap[K, V]) Clear()
- func (m *ActiveMap[K, V]) Delete(k K)
- func (m *ActiveMap[K, V]) DeleteInactive(lifetime time.Duration)
- func (m *ActiveMap[K, V]) Each(fn func(k K, v V))
- func (m *ActiveMap[K, V]) Len() int
- func (m *ActiveMap[K, V]) Load(k K) (v V, ok bool)
- func (m *ActiveMap[K, V]) Store(k K, v V)
- type Array
- type ArrayAnySync
- type Comparable
- type FakeMap
- type Float
- type IMap
- type Integer
- type Map
- type Number
- type Signed
- type SyncMap
- type Unsigned
Constants ¶
View Source
const ( ESCAPE = 92 QUOTE = 34 SPACE = 32 TAB = 9 NEWLINE = 10 ASTERISK = 42 SLASH = 47 )
Variables ¶
This section is empty.
Functions ¶
func CompileJSONWithComment ¶
func IndexOf ¶
func IndexOf[T Comparable](arr []T, target T) int
func MidnightTime ¶
func RandomFromArray ¶
func RandomFromArray[T any](arr []T) T
func RandomString ¶
func RemoveByIdx ¶
func RemoveByIdx[T Comparable](arr *[]T, i int)
func ShuffleArray ¶
func ShuffleArray[T any](arr []T)
func TryRemoveByValue ¶
func TryRemoveByValue[T Comparable](arr *[]T, v T) int
Types ¶
type ActiveMap ¶
type ActiveMap[K Comparable, V any] struct { // contains filtered or unexported fields }
func NewActiveMap ¶
func NewActiveMap[K Comparable, V any](inteval, lifetime time.Duration) *ActiveMap[K, V]
inteval 检查过期的时钟周期 lifetime 不活跃数据生命时长,超过将删除
func (*ActiveMap[K, V]) DeleteInactive ¶
type Array ¶
type Array[V Comparable] struct { // contains filtered or unexported fields }
func (*Array[V]) RemoveByIndex ¶
func (*Array[V]) RemoveByValue ¶
type ArrayAnySync ¶
type ArrayAnySync[V any] struct { // contains filtered or unexported fields }
func (*ArrayAnySync[V]) At ¶
func (a *ArrayAnySync[V]) At(i int) V
func (*ArrayAnySync[V]) Each ¶
func (a *ArrayAnySync[V]) Each(fn func(V))
func (*ArrayAnySync[V]) Len ¶
func (a *ArrayAnySync[V]) Len() int
func (*ArrayAnySync[V]) PushBack ¶
func (a *ArrayAnySync[V]) PushBack(v V)
type Comparable ¶
type Comparable interface { comparable }
type FakeMap ¶
type FakeMap[K Comparable, V any] struct { // contains filtered or unexported fields }
func NewFakeMap ¶
func NewFakeMap[K Comparable, V any]() *FakeMap[K, V]
type IMap ¶
type IMap[K Comparable, V any] interface { Load(k K) (V, bool) Store(k K, v V) Delete(k K) Clear() Len() int Each(fn func(k K, v V)) }
type Map ¶
type Map[K Comparable, V any] struct { // contains filtered or unexported fields }
func NewMap ¶
func NewMap[K Comparable, V any]() *Map[K, V]
type SyncMap ¶
type SyncMap[K Comparable, V any] struct { // contains filtered or unexported fields }
func NewSyncMap ¶
func NewSyncMap[K Comparable, V any]() *SyncMap[K, V]
Click to show internal directories.
Click to hide internal directories.