util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CastInteger added in v0.2.0

func CastInteger[F Integer, T Integer](from F) T

func CastIntegers added in v0.2.0

func CastIntegers[F Integer, T Integer](from []F) []T

func ContainInt

func ContainInt(vs []int, t int) bool

func ContainInt32

func ContainInt32(vs []int32, t int32) bool

func ContainInt64

func ContainInt64(vs []int64, t int64) bool

func ContainUint

func ContainUint(vs []uint, t uint) bool

func ContainUint32

func ContainUint32(vs []uint32, t uint32) bool

func ContainUint64

func ContainUint64(vs []uint64, t uint64) bool

func DistinctInt

func DistinctInt(vs []int) (res []int)

func DistinctInteger added in v0.2.0

func DistinctInteger[T Integer](vs []T) (res []T)

func JSONPretty

func JSONPretty(v interface{}) string

func JSONString

func JSONString(v interface{}) string

func MaxInt

func MaxInt(a, b int) int

func MaxInt64 added in v0.2.0

func MaxInt64(a, b int64) int64

func MinInt

func MinInt(a, b int) int

func MinInt64

func MinInt64(a, b int64) int64

func MinUInt64

func MinUInt64(a, b uint64) uint64

func NilInterface added in v0.2.0

func NilInterface(v interface{}) bool

func PanicIf

func PanicIf(cond bool, format string, v ...interface{})

PanicIf a panic helper to invoke panic when cond is true user/client need responsible for the work of logging/print error detail

func PanicIfErr

func PanicIfErr(err error, format string, v ...interface{})

PanicIfErr a panic helper to invoke panic when err is not nil user/client need responsible for the work of logging/print error detail

func Ptr added in v0.2.0

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

func RunesToBytes

func RunesToBytes(rs []rune) []byte

Types

type Integer added in v0.2.0

type Integer interface {
	int8 | int16 | int32 | int | int64 | uint8 | uint16 | uint32 | uint | uint64
}

Jump to

Keyboard shortcuts

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