Documentation
¶
Index ¶
- func Abs[t int | int8 | int16 | int32 | int64 | float32 | float64](num t) t
- func Caintains[T comparable](s []T, v T) bool
- func CheckTimeBetween(t time.Time, start, end string) (bool, error)
- func DayEnd(t ...time.Time) time.Time
- func DayStart(t ...time.Time) time.Time
- func FloatMulti(a, b float64) decimal.Decimal
- func GetRealIP(r *http.Request) string
- func GetUidFromCtx(ctx context.Context) uint64
- func GetWeekdayMidnightISO(t time.Time, targetWeekday time.Weekday) time.Time
- func GetWholeWeekDays(t time.Time) []time.Time
- func Int64ToString(nTimeStamp int64) (strTime string)
- func Int64ToTime(nTime int64) time.Time
- func IntervalToDuration(interval string) time.Duration
- func IntervalToSec(interval string) int64
- func IsZero(v any) bool
- func Map2Map[K1 comparable, V1 any, K2 comparable, V2 any](m map[K1]V1, fn func(K1, V1) (K2, V2)) map[K2]V2
- func Map2Slice[K comparable, V any](m map[K]V) []V
- func MapKey2Slice[K comparable, V any](m map[K]V) []K
- func MonthEnd(t ...time.Time) time.Time
- func MonthStart(t ...time.Time) time.Time
- func ObjectIDToUint64(in primitive.ObjectID) uint64
- func ParseLocalTime(layout, value string) (time.Time, error)
- func ParseTimeRange(value string) (start, end time.Time, err error)
- func RandNumWithCheck(length, try int, fn func(uint64) bool) (uint64, error)
- func ReflectFields(v any) map[string]any
- func SearchIndex[E comparable](slice []E, element E) int
- func Slice2Any[T any](s []T) []any
- func Slice2Map[K comparable, V any](s []V, keyFn func(V) K) map[K]V
- func Slice2Set[T any, K comparable](s []T, fn func(T) K) []K
- func Slice2Slice[T any, R any](s []T, fn func(T) R) []R
- func Str2ObjectID(str string) primitive.ObjectID
- func StringToInt64(strTime string) (nTimeStamp int64)
- func StringToTime(strTime string) time.Time
- func Time64ToTime(t int64) time.Time
- func TimeBeforeOrLater(curr_time int64, tag string, year_diff int, month_diff time.Month, ...) (target_time int64)
- func TimeToString(t time.Time) string
- func TimetToInt64(tTime time.Time) (nTime int64)
- func TimetToString(tTime time.Time) (strTime string)
- func ToPtr[T any](v T) *T
- func Today() time.Time
- func TodayInt64ToInt(time64 int64) int
- func TodayInt64ToStr(time64 int64) string
- func Todaystr() string
- func Uint64ToObjectID(num uint64) primitive.ObjectID
- func Yesterday() string
- func YesterdayInt64ToInt(time64 int64) int
- func YesterdayInt64ToStr(time64 int64) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Caintains ¶
func Caintains[T comparable](s []T, v T) bool
func FloatMulti ¶
func GetUidFromCtx ¶
func GetWeekdayMidnightISO ¶
/////////////////////////////////Begin给出任一个时间,算出该时间所属于的周一到周日的0点时间/////////////////////////////////////////////////
func Int64ToString ¶
////////////////////////////////////////////////////////////////////////////////////////
func Int64ToTime ¶
func IntervalToDuration ¶
func IntervalToSec ¶
func Map2Map ¶
func Map2Map[K1 comparable, V1 any, K2 comparable, V2 any](m map[K1]V1, fn func(K1, V1) (K2, V2)) map[K2]V2
func Map2Slice ¶
func Map2Slice[K comparable, V any](m map[K]V) []V
func MapKey2Slice ¶
func MapKey2Slice[K comparable, V any](m map[K]V) []K
func ObjectIDToUint64 ¶
ObjectIDToUint64 将 [12]byte 数组转换为 uint64,只读取前 8 字节并按大端解析
func RandNumWithCheck ¶
func ReflectFields ¶
ReflectFields 反射对象内容字段,主要是为了获取对象是否包括哪些字段。
func SearchIndex ¶
func SearchIndex[E comparable](slice []E, element E) int
func Slice2Map ¶
func Slice2Map[K comparable, V any](s []V, keyFn func(V) K) map[K]V
func Slice2Set ¶
func Slice2Set[T any, K comparable](s []T, fn func(T) K) []K
func Slice2Slice ¶
func Str2ObjectID ¶
func StringToInt64 ¶
func StringToTime ¶
////////////////////////////////////////////////////////////////////////////////////////////////
func Time64ToTime ¶
func TimeBeforeOrLater ¶
func TimeBeforeOrLater(curr_time int64, tag string, year_diff int, month_diff time.Month, day_diff, hour_diff, min_diff, sec_diff int) (target_time int64)
////////////////////////////////////////////////////////////////////////////////////////
func TimeToString ¶
func TimetToInt64 ¶
////////////////////////////////////////////////////////////////////////////////////////////////
func TimetToString ¶
func Uint64ToObjectID ¶
Uint64ToObjectID 将 uint64 转换为 [12]byte 数组,前 8 字节为大端表示,后 4 字节为 0 填充
Types ¶
This section is empty.