util

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FMap1

func FMap1[I1 any, ResultType any, NewResultType any](f func(in I1) (ResultType, error), c func(ResultType) NewResultType) func(in I1) (NewResultType, error)

func FMap2

func FMap2[I1 any, I2 any, ResultType any, NewResultType any](f func(in1 I1, in2 I2) (ResultType, error), c func(ResultType) NewResultType) func(in1 I1, in2 I2) (NewResultType, error)

func FMap3

func FMap3[I1 any, I2 any, I3 any, ResultType any, NewResultType any](f func(in1 I1, in2 I2, in3 I3) (ResultType, error), c func(ResultType) NewResultType) func(in1 I1, in2 I2, in3 I3) (NewResultType, error)

func FMap4

func FMap4[I1 any, I2 any, I3 any, I4 any, ResultType any, NewResultType any](f func(in1 I1, in2 I2, in3 I3, in4 I4) (ResultType, error), c func(ResultType) NewResultType) func(in1 I1, in2 I2, in3 I3, in4 I4) (NewResultType, error)

func FMap5

func FMap5[I1 any, I2 any, I3 any, I4 any, I5 any, ResultType any, NewResultType any](f func(in1 I1, in2 I2, in3 I3, in4 I4, in5 I5) (ResultType, error), c func(ResultType) NewResultType) func(in1 I1, in2 I2, in3 I3, in4 I4, in5 I5) (NewResultType, error)

func ListContains

func ListContains[T any](list []T, check func(a T) bool) bool

func ListFilter

func ListFilter[T any](in []T, filter func(T) bool) (out []T)

func ListFilterDuplicates

func ListFilterDuplicates[T any](s []T, equals func(a T, b T) bool) (out []T)

func ListMap

func ListMap[From any, To any](from []From, converter func(From) To) (to []To)

func ListSort

func ListSort[T any](list []T, less func(a T, b T) bool)

func MapKeys

func MapKeys[T1 comparable, T2 any](m map[T1]T2) (result []T1)

Types

type SyncMap

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

func NewSyncMap

func NewSyncMap[T any]() *SyncMap[T]

func (*SyncMap[T]) Do

func (this *SyncMap[T]) Do(f func(m *map[string]T))

func (*SyncMap[T]) Get

func (this *SyncMap[T]) Get(key string) (value T, ok bool)

func (*SyncMap[T]) GetAll

func (this *SyncMap[T]) GetAll() (result map[string]T)

func (*SyncMap[T]) GetKeys

func (this *SyncMap[T]) GetKeys() (keys []string)

func (*SyncMap[T]) Remove

func (this *SyncMap[T]) Remove(key string)

func (*SyncMap[T]) Set

func (this *SyncMap[T]) Set(key string, value T)

func (*SyncMap[T]) Update

func (this *SyncMap[T]) Update(key string, update func(value T) T)

Jump to

Keyboard shortcuts

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