Documentation
      ¶
    
    
  
    
  
    Index ¶
- 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 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 GetPositionValue(position string) (float64, float64)
 - func GetRandomBase64(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 IndexN(src string, c byte, n int) int
 - 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 MarshalNoErr(v any) string
 - func MatchIP(ip, iprange string) bool
 - func Random(length int, level int) string
 - func Recover(ctx context.Context)
 - 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 SqlNullStringToAny(in sql.NullString, ret any) error
 - 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 ToRpcNullDouble(val *float64) *wrappers.DoubleValue
 - 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 AnyToNullString ¶ added in v0.3.1
func AnyToNullString(in any) sql.NullString
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 MarshalNoErr ¶ added in v0.3.1
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
func SqlNullStringToAny ¶ added in v0.3.1
func SqlNullStringToAny(in sql.NullString, ret any) error
func TimeToInt64 ¶
func ToNullString ¶
func ToNullString(val *wrappers.StringValue) *string
func ToRpcNullDouble ¶ added in v0.3.0
func ToRpcNullDouble(val *float64) *wrappers.DoubleValue
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.