common

package
v1.21.12 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Zlib Imports: 4 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 ElementsTo added in v1.8.48

func ElementsTo[T EleType](c []T) []interface{}

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 IsBit added in v1.8.90

func IsBit[T BitType](v T, b T) bool

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 IsNilReflect added in v1.20.11

func IsNilReflect(v reflect.Value) 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 []any) []int

func SliceToInt64 added in v1.8.6

func SliceToInt64(arr []any) []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 ToInt added in v1.21.5

func ToInt[T IntegerType](arr []any) []T

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

func WhereInt added in v1.21.5

func WhereInt[T IntegerType](arr []any, where func(a any) (T, bool)) []T

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 Range added in v1.21.5

type Range[T IntegerType] struct {
	Op  string // "GT","GTE","LT","LTE","BET"
	Min T
	Max T
}

Range 范围

func (*Range[T]) Adjust added in v1.21.5

func (rg *Range[T]) Adjust()

func (*Range[T]) At added in v1.21.6

func (rg *Range[T]) At(at time.Duration, unit int) T

func (*Range[T]) Day added in v1.21.6

func (rg *Range[T]) Day(day time.Duration, unit int) T

func (*Range[T]) HasValid added in v1.21.5

func (rg *Range[T]) HasValid() bool

func (*Range[T]) Legal added in v1.21.7

func (rg *Range[T]) Legal(legal T)

func (*Range[T]) Month added in v1.21.6

func (rg *Range[T]) Month(month time.Duration, unit int) T

type ReverseType added in v1.5.7

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

Directories

Path Synopsis
e7z
gzip
Package gzip implements the Archive interface providing gz archiving and compression.
Package gzip implements the Archive interface providing gz archiving and compression.
tar
Package tar implements the Archive interface providing tar archiving.
Package tar implements the Archive interface providing tar archiving.
targz
Package targz implements the Archive interface providing tar.gz archiving and compression.
Package targz implements the Archive interface providing tar.gz archiving and compression.
tarxz
Package tarxz implements the Archive interface providing tar.xz archiving and compression.
Package tarxz implements the Archive interface providing tar.xz archiving and compression.
zip
Package zip implements the Archive interface providing zip archiving and compression.
Package zip implements the Archive interface providing zip archiving and compression.
alyoss
*
*

Jump to

Keyboard shortcuts

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