Documentation ¶
Index ¶
- Variables
- func AppendToFirst[T any](arr []T, ele T) []T
- func Contain[T comparable](slice []T, target T) bool
- func DeDup[T comparable, TS ~[]T](input TS) []T
- func DeRef2[T any](input *T, err error) (T, error)
- func DecodeLength(bytes []byte) (int, int, error)
- func EncodeLength(bytes *[]byte, length int)
- func Find[T any, TS ~[]T](slice TS, predicate func(T) bool) (T, bool)
- func FindIndex[T any, TS ~[]T](slice TS, predicate func(T) bool) int
- func FindIndexByValue[T comparable, TS ~[]T](slice TS, predicate T) int
- func MakeWebsocketURL(endpoint string) (string, error)
- func Map[T any, O any, TS ~[]T](input TS, mapper func(T) O) []O
- func MapInt[T constraints.Integer, O constraints.Integer, TS ~[]T](input TS) []O
- func MapWithError[T any, O any, TS ~[]T](input TS, mapper func(T) (O, error)) ([]O, error)
- func MergeList[T any, TS ~[]T](args ...TS) []T
- func PowInt[T uint8 | int8 | uint16 | int16 | uint32 | int32 | uint64 | int64 | int | uint](base T, p int) T
- func RemoveEle[T comparable](arr []T, ele func(T) bool) []T
- func RemoveIndex[T any](arr []T, index int) []T
- func StructToMap(obj any) map[string]any
- func SumInt[T uint8 | int8 | uint16 | int16 | uint32 | int32 | uint64 | int64 | int | uint, ...](base []O, callback func(O) T) T
- type KVMap
- type Set
Constants ¶
This section is empty.
Variables ¶
View Source
var URL_RE = regexp.MustCompile(`^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)`)
Functions ¶
func AppendToFirst ¶
func AppendToFirst[T any](arr []T, ele T) []T
func Contain ¶
func Contain[T comparable](slice []T, target T) bool
func DeDup ¶
func DeDup[T comparable, TS ~[]T](input TS) []T
func EncodeLength ¶
func FindIndexByValue ¶
func FindIndexByValue[T comparable, TS ~[]T](slice TS, predicate T) int
func MakeWebsocketURL ¶
MakeWebsocketURL generates a WebSocket URL based on the provided endpoint
func MapInt ¶
func MapInt[T constraints.Integer, O constraints.Integer, TS ~[]T](input TS) []O
func MapWithError ¶
func RemoveEle ¶
func RemoveEle[T comparable](arr []T, ele func(T) bool) []T
func RemoveIndex ¶
func StructToMap ¶
StructToMap converts a struct to a map[string]interface{}
Types ¶
type KVMap ¶
type KVMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewKVMap ¶
func NewKVMap[K comparable, V any]() *KVMap[K, V]
func (*KVMap[K, V]) InsertOrUpdate ¶
func (m *KVMap[K, V]) InsertOrUpdate(key K, value V, update func(*V))
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func NewSet ¶
func NewSet[T comparable]() *Set[T]
func (*Set[T]) AddIfNotExists ¶
func (s *Set[T]) AddIfNotExists(value T)
Click to show internal directories.
Click to hide internal directories.