Documentation
¶
Index ¶
- func AesCbcBase64(src, productSecret string) (string, error)
- func AnyToDecimal(num string, n int) int64
- func AnyToNullString(in any) sql.NullString
- func CheckPasswordLever(ps string) int32
- func CheckUserName(name string) error
- func Convert(src any, dst any) any
- func CopyContext(ctx context.Context) context.Context
- func Decimal[valueType constraints.Float](value valueType, n int) valueType
- func DecimalToAny(num, n int64) string
- func FillZeroToLen(src string, length int) string
- func FirstLower(s string) string
- func FirstUpper(s string) string
- func Fmt(v any) string
- func FuncName() string
- func GetIP(r *http.Request) (string, error)
- func GetMonthDays(years int, month time.Month) int
- func GetNodeID(cache cache.ClusterConf, svrName string) int64
- func GetNullTime(time sql.NullTime) int64
- func GetPositionValue(position string) (float64, float64)
- func GetRandomBase64(length int) string
- func GetSubDay(base time.Time, cmp time.Time) int64
- func Go(ctx context.Context, f func())
- func GoNewCtx(ctx context.Context, f func(ctx2 context.Context))
- func HandleThrow(ctx context.Context, p any)
- func HmacSha1(data string, secret []byte) string
- func HmacSha256(data string, secret []byte) string
- func IndexN(src string, c byte, n int) int
- func Int64ToTimex(in int64) *time.Time
- func Ip2binary(ip string) string
- func IsEmail(email string) bool
- func IsMobile(mobile string) bool
- func IsNil(i interface{}) bool
- func MD5V(str []byte) string
- func MakePwd(pwd string, uid int64, isMd5 bool) string
- func MarshalNoErr(v any) string
- func MatchIP(ip, iprange string) bool
- func Max[t CanAdd](in []t) t
- func MethodToNum(methond string) string
- func Min[t CanAdd](in []t) t
- func MoonPosition(t time.Time, lat, lng float64) (float64, float64, float64)
- func NewFillPlace(num int) string
- func NewFillSlice[T any](num int, val T) []T
- func NewFillString(num int, val string, sep string) string
- func NullTimeToTime(in sql.NullTime) *time.Time
- func PKCS5Padding(src []byte, blockSize int) []byte
- func PositionToBaidu(point def.Point) def.Point
- func PositionToEarth(point def.Point) def.Point
- func PrintVersion()
- func Random(length int, level int) string
- func Recover(ctx context.Context)
- func ReflectFields(ptr any, excludeFields []string) []any
- func SetToSlice[t constraints.Ordered](in map[t]struct{}) (ret []t)
- func SetVal(key any, src, dst any) (num int)
- func SetVals(src any, dst any) (num int)
- func SliceIn[T comparable](in T, cmp ...T) bool
- func SliceIndex[T any](slice []T, index int, defaul T) T
- func SliceLeftContain[T comparable](bases, childs []T) bool
- func SliceLeftDiff[T comparable](bases, childs []T) []any
- func SliceTo[retT any](values []string, cov func(any) retT) []retT
- func SplitCutset(str, cutset string) []string
- func SqlNullStringToAny(in sql.NullString, ret any) error
- func SqlToString(val sql.NullString) string
- func Sum[addT CanAdd](datas ...addT) (sum addT)
- func SunPosition(t time.Time, lat, lng float64) (float64, float64)
- func SunRiseTime(t time.Time, point def.Point) time.Time
- func SunSetTime(t time.Time, point def.Point) time.Time
- func SunTimes(t time.Time, point def.Point) map[string]time.Time
- func Time2ToInt64(t *time.Time) int64
- func TimeTo24Sec(t time.Time) int64
- func TimeToInt64(t time.Time) int64
- func TimeToNullTime(in *time.Time) sql.NullTime
- func TimeXToTime(t *time.Time) time.Time
- func ToDefPoint(coordinateSystem def.CoordinateSystem, position gocoord.Position) def.Point
- func ToEmptyInt64(val *wrappers.Int64Value) int64
- func ToEmptyString(val *wrappers.StringValue) string
- func ToMMddHHSS(timeStamp int64) string
- func ToNullInt64(val *wrappers.Int64Value) *int64
- func ToNullString(val *wrappers.StringValue) *string
- func ToNullTime(in int64) sql.NullTime
- func ToRpcNullDouble(val *float64) *wrappers.DoubleValue
- func ToRpcNullInt64(val any) *wrappers.Int64Value
- func ToRpcNullString(val any) *wrappers.StringValue
- func ToTimeX(t time.Time) *time.Time
- func ToYYMMdd(timeStamp int64) string
- func ToYYMMddHHSS(timeStamp int64) string
- func TraceIdFromContext(ctx context.Context) string
- func TrimNil[a any](in *a) a
- func Unmarshal(data []byte, v any) error
- func UnmarshalNoErr[inT any](data string) inT
- func VersionCompare(v1 string, v2 string) int
- type CanAdd
- type CheckExp
- type ExpMap
- type SnowFlake
- func (c *SnowFlake) GetMachineId() int64
- func (c *SnowFlake) GetSnowflakeId() (id int64)
- func (c *SnowFlake) MilliSecondToTime(milliSecond int64) (t time.Time)
- func (c *SnowFlake) MillisecondToTimeDb(ts int64) string
- func (c *SnowFlake) MillisecondToTimeTz(ts int64) string
- func (c *SnowFlake) ParseId(id int64) (milliSecond, mId, sn int64)
- func (c *SnowFlake) SetMachineId(mId int64)
- type SunAngle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesCbcBase64 ¶ added in v0.5.1
func AnyToNullString ¶ added in v0.3.1
func AnyToNullString(in any) sql.NullString
func FillZeroToLen ¶ added in v0.5.1
func GetNullTime ¶
func GetPositionValue ¶ added in v0.3.0
position 格式: POINT(100.101 50.894)
func GetRandomBase64 ¶ added in v0.3.0
func HandleThrow ¶
func HmacSha256 ¶
func Int64ToTimex ¶ added in v0.5.1
func MarshalNoErr ¶ added in v0.3.1
func MethodToNum ¶ added in v0.5.1
func MoonPosition ¶ added in v0.5.1
func NewFillSlice ¶ added in v0.5.1
func PKCS5Padding ¶ added in v0.5.1
func PrintVersion ¶ added in v0.5.1
func PrintVersion()
func ReflectFields ¶ added in v0.5.1
解析数据库 表结构字段, ptr:数据表结构, excludeFields:排除的字段名, 返回值:解析出的表结构字段值列表
func SetToSlice ¶ added in v0.3.0
func SetToSlice[t constraints.Ordered](in map[t]struct{}) (ret []t)
func SliceIn ¶ added in v0.3.1
func SliceIn[T comparable](in T, cmp ...T) bool
SliceIn 判断 in 是否在 cmp 中
func SliceIndex ¶ added in v0.5.1
SliceIndex 获取 T[index] 的值,否则返回默认 defaul
func SliceLeftContain ¶ added in v0.5.1
func SliceLeftContain[T comparable](bases, childs []T) bool
SliceLeftContain 判断 childs 是否包含在 bases 里(忽略 childs 多出来的值); 如 bases=[1,2,3], childs=[2,3,4],则会返回true;
func SliceLeftDiff ¶ added in v0.5.1
func SliceLeftDiff[T comparable](bases, childs []T) []any
SliceLeftDiff 判断 childs 是否包含在 bases 里(忽略 childs 多出来的值); 如 bases=[1,2,3], childs=[2,3,4],则会返回true;
func SplitCutset ¶ added in v0.5.1
SplitCutset 按数组 cuset 里的分隔符,对 str 进行切割
func SqlNullStringToAny ¶ added in v0.3.1
func SqlNullStringToAny(in sql.NullString, ret any) error
func SqlToString ¶ added in v0.5.1
func SqlToString(val sql.NullString) string
func SunPosition ¶ added in v0.5.1
func Time2ToInt64 ¶ added in v0.5.1
func TimeToInt64 ¶
func ToDefPoint ¶ added in v0.5.1
func ToEmptyInt64 ¶ added in v0.5.1
func ToEmptyInt64(val *wrappers.Int64Value) int64
func ToEmptyString ¶ added in v0.5.1
func ToEmptyString(val *wrappers.StringValue) string
func ToNullInt64 ¶ added in v0.5.1
func ToNullInt64(val *wrappers.Int64Value) *int64
func ToNullString ¶
func ToNullString(val *wrappers.StringValue) *string
func ToNullTime ¶ added in v0.4.1
func ToRpcNullDouble ¶ added in v0.3.0
func ToRpcNullDouble(val *float64) *wrappers.DoubleValue
func ToRpcNullInt64 ¶ added in v0.5.1
func ToRpcNullInt64(val any) *wrappers.Int64Value
func ToRpcNullString ¶
func ToRpcNullString(val any) *wrappers.StringValue
func TraceIdFromContext ¶
func UnmarshalNoErr ¶ added in v0.5.1
func VersionCompare ¶ added in v0.6.0
版本号对比:v1 > v2 ==> 1 或 v1 < v2 ==> -1 或 v1 == v2 ==> 0
Types ¶
type CanAdd ¶
type CanAdd interface { constraints.Integer | constraints.Float }
type SnowFlake ¶
type SnowFlake struct {
// contains filtered or unexported fields
}
func NewSnowFlake ¶
func (*SnowFlake) GetSnowflakeId ¶
获取雪花 返回值 id:自增id ts:生成该id的毫秒时间戳
func (*SnowFlake) MilliSecondToTime ¶
毫秒转换成time
func (*SnowFlake) MillisecondToTimeDb ¶
毫秒转换成"2006-01-02 15:04:05.999"
func (*SnowFlake) MillisecondToTimeTz ¶
毫秒转换成"20060102T150405.999Z"
Source Files
¶
Click to show internal directories.
Click to hide internal directories.