typer

package
v0.0.0-...-6357336 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPropertyType = errors.New("got/typer: convert type failed")

Functions

func Any

func Any[T any](v T) any

func AssertNil

func AssertNil[T any](v T, terminator ...delegate.Action) bool

func AssertNotNil

func AssertNotNil[T any](v T, terminator ...delegate.Action) bool

func AssertType

func AssertType[TAssert, TVal any](v TVal, terminator ...delegate.Action) bool

func AssertZeroVal

func AssertZeroVal[T comparable](v T, terminator ...delegate.Action) bool

func Between

func Between[T constraints.Ordered](v T, begin, end T) bool

func ConvI2I64Any

func ConvI2I64Any(val any) (int64, error)

func Convert

func Convert[T any](val any, defaultV T) (T, error)

func ConvertMust

func ConvertMust[T any](val any) T

func I2Str

func I2Str[T constraints.Integer](num T) string

func IfThen

func IfThen[T any](cond bool, a T, b T) T

func IsNil

func IsNil(v any) bool

func IsNotNil

func IsNotNil(v any) bool

func IsType

func IsType[TAssert, TVal any](v TVal) bool

func IsZero

func IsZero[T comparable](v T) bool

func Keys

func Keys[TKey comparable, TVal any](m map[TKey]TVal) []TKey

func KeysSorted

func KeysSorted[TKey constraints.Ordered, TVal any](m map[TKey]TVal) []TKey

func MapDump

func MapDump[TKey comparable, TVal any](m map[TKey]TVal, dumper delegate.Func2[TKey, TVal, string]) []string

func MapForEachOrderly

func MapForEachOrderly[TKey constraints.Ordered, TVal any](m map[TKey]TVal, traver func(key TKey, val TVal))

func MapMap

func MapMap[TKey comparable, TVal any, TKey1 comparable, TVal1 any](m map[TKey]TVal, keyConv delegate.Convert[TKey, TKey1], valConv delegate.Convert[TVal, TVal1]) map[TKey1]TVal1

func Or

func Or[T comparable](a, b T) T

func PanicWhenError

func PanicWhenError(err error, fmtOrMsg string, args ...any)

func Ptr

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

func S2IMust

func S2IMust[T constraints.Integer](str string) T

func SliceContains

func SliceContains[TVal comparable](slice []TVal, val TVal) bool

func SliceFilter

func SliceFilter[TVal comparable](slice []TVal, pred delegate.Predicate[TVal]) []TVal

func SliceFirst

func SliceFirst[TVal comparable](slice []TVal, val TVal) int

func SliceFirstMatch

func SliceFirstMatch[TVal comparable](slice []TVal, pred delegate.Predicate[TVal]) int

func SliceForeach

func SliceForeach[TSliceVal any](slice []TSliceVal, foreachFn delegate.Action1[TSliceVal])

func SliceForeachI

func SliceForeachI[TSliceVal any](slice []TSliceVal, foreachFn delegate.Action2[TSliceVal, int])

func SliceLast

func SliceLast[TSliceVal any](slice []TSliceVal) TSliceVal

func SliceMap

func SliceMap[TFrom, TTo any](from []TFrom, mapFn delegate.Convert[TFrom, TTo]) []TTo

func SliceMax

func SliceMax[TSliceVal constraints.Ordered](data []TSliceVal) (ret TSliceVal)

func SliceMin

func SliceMin[TSliceVal constraints.Ordered](data []TSliceVal) (ret TSliceVal)

func SlicePadRight

func SlicePadRight[TSliceVal any](slice []TSliceVal, length int, padVal TSliceVal) []TSliceVal

func SliceRand

func SliceRand[TVal comparable](slice []TVal, defaultVal TVal) TVal

func SliceReduce

func SliceReduce[TSliceVal, TTarget any](slice []TSliceVal, reduceFn func(TSliceVal, TTarget) TTarget, defaultVal TTarget) TTarget

func SliceReverse

func SliceReverse[TSliceVal any](data []TSliceVal)

func SliceSort

func SliceSort[TSliceVal constraints.Ordered](slice []TSliceVal)

func SliceTryGet

func SliceTryGet[TSliceVal any](slice []TSliceVal, i int, defaultVal TSliceVal) TSliceVal

func Str

func Str[T any](v T) string

func ZeroVal

func ZeroVal[T any]() (v T)

Types

This section is empty.

Jump to

Keyboard shortcuts

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