dfunc

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AndroidSetTimeZone

func AndroidSetTimeZone()

func ArrayMax added in v0.7.0

func ArrayMax[T ~int | ~int8 | ~int16 | ~int32 | ~int64](array ...T) T

func Assert

func Assert(guard bool, text string)

func BytesToString added in v0.9.0

func BytesToString(b []byte) string

func GetPointer

func GetPointer[T any](v T) *T

GetPointer 获得指定值的指针

func In added in v0.9.2

func In[T comparable](value T, list ...T) bool

func Max added in v0.7.0

func Max[T ~int | ~int8 | ~int16 | ~int32 | ~int64](v1, v2 T) T

func Min

func Min[T ~int | ~int8 | ~int16 | ~int32 | ~int64](v1, v2 T) T

func NewWaitGroup

func NewWaitGroup(maxConcurrent, count int) *waitGroup

NewWaitGroup maxConcurrent最大并发,count总数

func PointerSafeGetter

func PointerSafeGetter[T any](v1 *T, dv T) T

PointerSafeGetter 空指针安全判定获取值 dv:默认值

func Select

func Select[T any](condition int, values ...T) T

Select 选择输出

func SliceUnique

func SliceUnique[T comparable](s *[]T)

SliceUnique slice去重

func Sort

func Sort[T any](s []T, less func(T, T) bool)

func Stack

func Stack(skip int) []byte

func StringToBytes added in v0.9.0

func StringToBytes(s string) []byte

func TernaryOperator

func TernaryOperator[T any](condition bool, trueValue, falseValue T) T

TernaryOperator 三目运算

func TernaryOperatorDo added in v0.8.0

func TernaryOperatorDo(condition bool, trueFunc, falseFunc func())

TernaryOperatorDo 三目函数

func TernaryOperatorGet added in v0.8.0

func TernaryOperatorGet[T any](condition bool, trueValueFunc, falseValueFunc func() T) T

TernaryOperatorGet 三目函数运算

func TestingHandlerError

func TestingHandlerError(t *testing.T, err error)

func TestingHandlerErrorWithValue

func TestingHandlerErrorWithValue[T any](t *testing.T, getter func() (T, error)) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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