basic

package
v1.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ShanghaiLocation 上海时区
	ShanghaiLocation = "Asia/Shanghai"
	// UTCLocation UTC时区
	UTCLocation = "UTC"
	// GMTLocation GMT时区
	GMTLocation = "GMT"
	// CSTLocation CST时区
	CSTLocation = "CST"
	// CST6CDTLocation CST6CDT时区
	CST6CDTLocation = "CST6CDT"
	// LocalLocation 本地时区
	LocalLocation = "Local"

	DefaultLocation = ShanghaiLocation

	// DefaultTimeFormat 默认时间格式
	DefaultTimeFormat = "2006-01-02 15:04:05"
)

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 Int64ToTime

func Int64ToTime(t int64) *time.Time

Int64ToTime 将int64转换为time.Time

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 SetTimeLocation

func SetTimeLocation(location string)

SetTimeLocation 设置时区

func StringToTime

func StringToTime(t string, layout ...string) *time.Time

StringToTime 将string转换为time.Time

func TimeToInt64

func TimeToInt64(t *time.Time) int64

TimeToInt64 将time.Time转换为int64

func TimeToString

func TimeToString(t *time.Time, layout ...string) string

TimeToString 将time.Time转换为string

func TimeToStringInLocation

func TimeToStringInLocation(t *time.Time, layout ...string) string

TimeToStringInLocation 将time.Time转换为string

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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