Documentation
¶
Index ¶
- func AnyToDecimal(num string, n int) int64
- func CheckPasswordLever(ps string) int32
- func CheckUserName(name string) error
- func Convert(src any, dst any) any
- func Decimal[valueType constraints.Float](value valueType, n int) valueType
- func DecimalToAny(num, n int64) string
- func Fmt(v any) string
- func FuncName() string
- func GetDeadLine(ctx context.Context, defaultDeadLine time.Time) time.Time
- 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 GetPassword(length int, level int) string
- func GetPwdBase64(length int) string
- func GetSubDay(base time.Time, cmp time.Time) int64
- func HandleThrow(ctx context.Context, p any)
- func HmacSha1(data string, secret []byte) string
- func HmacSha256(data string, secret []byte) string
- func Ip2binary(ip string) string
- func IsEmail(email string) bool
- func IsMobile(mobile string) bool
- func MD5V(str []byte) string
- func MakePwd(pwd string, uid int64, isMd5 bool) string
- func MatchIP(ip, iprange string) bool
- func Recover(ctx context.Context)
- func SetVal(key any, src, dst any) (num int)
- func SetVals(src any, dst any) (num int)
- func Sum[addT CanAdd](datas ...addT) (sum addT)
- func TimeToInt64(t time.Time) int64
- func ToLen(src string, length int) string
- func ToMMddHHSS(timeStamp int64) string
- func ToNullString(val *wrappers.StringValue) *string
- func ToRpcNullString(val *string) *wrappers.StringValue
- func ToYYMMdd(timeStamp int64) string
- func ToYYMMddHHSS(timeStamp int64) string
- func TraceIdFromContext(ctx context.Context) string
- func Unmarshal(data []byte, v any) error
- 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)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNullTime ¶
func GetPassword ¶
@in len 密码的长度 @in level 密码的强度级别 0:包含数字和字母 1:包含数字字母和特殊字符
func GetPwdBase64 ¶
func HandleThrow ¶
func HmacSha256 ¶
func TimeToInt64 ¶
func ToNullString ¶
func ToNullString(val *wrappers.StringValue) *string
func ToRpcNullString ¶
func ToRpcNullString(val *string) *wrappers.StringValue
func TraceIdFromContext ¶
Types ¶
type CanAdd ¶
type CanAdd interface {
constraints.Integer | constraints.Float
}
type SnowFlake ¶
type SnowFlake struct {
// contains filtered or unexported fields
}
func NewSnowFlake ¶
var Snow = &SnowFlake{
lastTime: time.Now().UnixNano() / 1000000,
machineID:1,
}
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.