common

package
v1.8.15 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Zlib Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Defined added in v1.0.54

func Defined(data interface{}, field string) bool

Defined checks if variable is defined in a struct

func Dict added in v1.0.54

func Dict(values ...interface{}) (map[string]interface{}, error)

Dict allows to send more than one variable into a template

func ExcludeElement added in v1.3.52

func ExcludeElement[T EleType](all []T, src ...T) []T

ExcludeElement 排除 找src不存在all

func FilterElement added in v1.3.52

func FilterElement[T EleType](all []T, cb FilterFunc[T]) []T

FilterElement 过滤某元素

func FindElement added in v1.3.54

func FindElement[T EleType](all []T, src T) bool

func IncludeElement added in v1.3.52

func IncludeElement[T EleType](all []T, src ...T) []T

IncludeElement 包含 找src在all

func IsMap added in v1.0.54

func IsMap(o interface{}) bool

IsMap checks if some variable is a map

func IsNil

func IsNil(o interface{}) bool

func IsSlice added in v1.0.54

func IsSlice(o interface{}) bool

IsSlice checks if some variable is a slice

func RemoveDuplicateElement added in v1.0.53

func RemoveDuplicateElement[T EleType](values []T) []T

RemoveDuplicateElement 除重

func RemoveElement added in v1.3.52

func RemoveElement[T EleType](all []T, src T) []T

RemoveElement 移除某元素

func ReverseElement added in v1.5.7

func ReverseElement[T ReverseType](rs []T) []T

func SliceToInt added in v1.8.6

func SliceToInt(arr []interface{}) []int

func SliceToInt64 added in v1.8.6

func SliceToInt64(arr []interface{}) []int64

func ToFloat64 added in v1.1.36

func ToFloat64(value interface{}) float64

func ToFloat64V2 added in v1.1.36

func ToFloat64V2(reflectValue reflect.Value) float64

func ToInt64 added in v1.1.36

func ToInt64(value interface{}) int64

func ToInt64V2 added in v1.1.36

func ToInt64V2(reflectValue reflect.Value) int64

func ToUInt64 added in v1.1.36

func ToUInt64(value interface{}) uint64

func ToUInt64V2 added in v1.1.36

func ToUInt64V2(reflectValue reflect.Value) uint64

Types

type Bit added in v1.3.46

type Bit[T BitType] interface {
	Int() T
}

type BitType added in v1.3.46

type BitType interface {
	int8 | int | int32 | int64 | uint8 | uint | uint32 | uint64
}

type EleType added in v1.0.53

type EleType interface {
	string | bool | int8 | int16 | int | int32 | int64 | uint8 | uint16 | uint | uint32 | uint64 | float32 | float64
}

type FilterFunc added in v1.3.52

type FilterFunc[T EleType] func(v T) bool

type Flag added in v1.3.46

type Flag[T BitType] struct {
	FInt T `json:"flag,omitempty"`
}

func WithFlag added in v1.3.46

func WithFlag[T BitType](flag T) Flag[T]

func (Flag[T]) Int added in v1.3.46

func (f Flag[T]) Int() T

func (Flag[T]) IsBit added in v1.3.46

func (f Flag[T]) IsBit(bit Bit[T]) bool

func (Flag[T]) Must added in v1.6.10

func (f Flag[T]) Must(i T) Flag[T]

func (Flag[T]) MustFlag added in v1.6.10

func (f Flag[T]) MustFlag(i Flag[T]) Flag[T]

type IntegerType added in v1.3.40

type IntegerType interface {
	int8 | int16 | int | int32 | int64 | uint8 | uint16 | uint | uint32 | uint64 | float32 | float64
}

type ReverseType added in v1.5.7

type ReverseType interface {
	rune | bool | int8 | int16 | int64 | uint8 | uint16 | uint32 | uint64 | float32 | float64
}

Jump to

Keyboard shortcuts

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