helper

package
v0.0.0-...-1f40810 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CutUrlHost

func CutUrlHost(u string) string

func DefaultVal

func DefaultVal[T any](v, defaults T) T

func Defaults

func Defaults[T comparable](v, defaults T) T

func FileExist

func FileExist(path string) bool

func GetAnyVal

func GetAnyVal[T any](v any, defaults T) T

func GetContextVal

func GetContextVal[V, K any](ctx context.Context, k K, defaults V) V

func IsImplements

func IsImplements[T, A any](i A) (T, bool)

func IsZero

func IsZero[T comparable](t T) bool

func IsZeros

func IsZeros(v any) bool

func Or

func Or[T any](is bool, left, right T) T

func ParseArgs

func ParseArgs[T any](defaults T, a ...any) T

func RunFnWithTimeout

func RunFnWithTimeout(ctx context.Context, t time.Duration, call func(), a ...any) (err error)

func RunFnWithTimeouts

func RunFnWithTimeouts[A, V any](ctx context.Context, t time.Duration, ar A, call func(A) (V, error), a ...any) (v V, err error)

func StructColumnToSlice

func StructColumnToSlice[T any, M any](arr []M, field string) (r []T)

func ToAny

func ToAny[T any](v T) any

func ToBool

func ToBool[T comparable](t T) bool

func ToBoolInt

func ToBoolInt(t any) int8

func UrlScheme

func UrlScheme(u string, isHttps bool) string

Types

type PaginationData

type PaginationData[T any] struct {
	Data     []T
	TotalRaw int
}

Directories

Path Synopsis
Package number 使用随机数时需要先 调用 rand.seed()函数
Package number 使用随机数时需要先 调用 rand.seed()函数

Jump to

Keyboard shortcuts

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