assert

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T Number](x T) T

Abs returns the absolute value of x.

func Count

func Count(target any) int

Count counts the number of elements in a slice.

func IsArray

func IsArray(i any) bool

IsArray returns true if the given value is an array.

func IsMap

func IsMap(i any) bool

IsMap returns true if the given value is a map.

func IsSlice

func IsSlice(i any) bool

IsSlice returns true if the given value is a slice.

func IsStruct

func IsStruct(i any) bool

IsStruct 判断参数是否为结构体或者结构体指针

func IsStructPtr

func IsStructPtr(i any) bool

IsStructPtr 判断参数是否为结构体指针

func Max

func Max[T Number](x, y T) T

Max returns the largest of x or y.

func Min

func Min[T Number](x, y T) T

Min returns the smallest of x or y.

func StructToMap

func StructToMap[T any](i T) map[string]interface{}

StructToMap 将结构体转换为map

func ToString

func ToString(v any) string

ToString converts a value to a string.

Types

type Basic

type Basic interface {
	~bool | ~string | Number
}

type Float

type Float interface {
	~float32 | ~float64
}

type Int

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

type Number

type Number interface {
	Int | Float
}

Jump to

Keyboard shortcuts

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