Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTimeOut(tm int64, timeout time.Duration) bool
- func Decode(c interface{}) error
- func GetSummary(i interface{}) ([]byte, error)
- func HexDecode(in string) ([]byte, error)
- func HongKong() *time.Location
- func Local() *time.Location
- func Location(name string) *time.Location
- func Secp256k1Verify(msg, sig, pubKey []byte) (b bool)
- func Shanghai() *time.Location
- func Sleep(n int64)
- func SleepMicro(n int64)
- func SleepMilli(n int64)
- func StringToTime(str, format string, location ...*time.Location) (time.Time, error)
- func StringToTimeDefault(str string) time.Time
- func StringToUnix(str, format string, location ...*time.Location) int64
- func TimeNowDate(location ...*time.Location) string
- func TimeNowDateTime(location ...*time.Location) string
- func TimeNowFormat(layout string, location ...*time.Location) string
- func TimeNowUnix(location ...*time.Location) int64
- func TimeNowUnixMicro(location ...*time.Location) int64
- func TimeNowUnixMilli(location ...*time.Location) int64
- func TimeNowUnixNano(location ...*time.Location) int64
- func ToBool(val interface{}) bool
- func ToFloat64(val interface{}) float64
- func ToInt(val interface{}) int
- func ToInt32(o interface{}) int32
- func ToInt32E(o interface{}) (int32, error)
- func ToInt64(val interface{}) int64
- func ToInt64E(val interface{}) (int64, error)
- func ToString(val interface{}) string
- func ToUInt32(val interface{}) uint32
- func ToUInt64(val interface{}) uint64
- func TypeToString(val interface{}) string
- func UTC() *time.Location
- func UnixAddDate(timestamp int64, years, months, days int) time.Time
- func UnixAddDays(timestamp int64, days int) time.Time
- func UnixAddMonths(timestamp int64, months int) time.Time
- func UnixAddYears(timestamp int64, years int) time.Time
- func UnixAfter(timestamp1 int64, timestamp2 int64) bool
- func UnixBefore(timestamp1 int64, timestamp2 int64) bool
- func UnixDifferDays(timestamp1 int64, timestamp2 int64) int
- func UnixDifferHours(timestamp1 int64, timestamp2 int64) float64
- func UnixEqual(timestamp1 int64, timestamp2 int64) bool
- func UnixToTime(timestamp int64) time.Time
- type Snowflake
Constants ¶
const ( Invalid = 0 SECP256K1 = 1 ED25519 = 2 SM2 = 3 )
Variables ¶
var ( ErrTransToInt64 = errors.New("transfer type int64 error") ErrTransToInt32 = errors.New("transfer type int32 error") )
Functions ¶
func Secp256k1Verify ¶
func SleepMicro ¶
func SleepMicro(n int64)
SleepMicro pauses the current goroutine for at least n microsecond.
func SleepMilli ¶
func SleepMilli(n int64)
SleepMilli pauses the current goroutine for at least n millisecond.
func StringToTime ¶
StringToTime returns time.Time representation of str value parsed according to layout.
func StringToTimeDefault ¶
func StringToUnix ¶
StringToUnix returns unix second timestamp representation of str value parsed according to layout. If str parsed err, it returns now unix second timestamp.
func TimeNowDate ¶
TimeNowDate returns a date representation of now time value.
func TimeNowDateTime ¶
TimeNowDateTime returns a datetime representation of now time value.
func TimeNowFormat ¶
TimeNowFormat returns a textual representation of now time value formatted according to layout.
func TimeNowUnix ¶
TimeNowUnix returns now unix second timestamp.
func TimeNowUnixMicro ¶
TimeNowUnixMicro returns now unix microsecond timestamp.
func TimeNowUnixMilli ¶
TimeNowUnixMilli returns now unix millisecond timestamp.
func TimeNowUnixNano ¶
TimeNowUnixNano returns now unix nanosecond timestamp.
func TypeToString ¶
func TypeToString(val interface{}) string
func UnixAddDate ¶
UnixAddDate returns time.Time after unix timestamp has been added date.
func UnixAddDays ¶
UnixAddDays returns time.Time after unix timestamp has been added days.
func UnixAddMonths ¶
UnixAddMonths returns time.Time after unix timestamp has been added months.
func UnixAddYears ¶
UnixAddYears returns time.Time after unix timestamp has been added years.
func UnixBefore ¶
UnixBefore reports whether timestamp1 is before timestamp2.
func UnixDifferDays ¶
UnixDifferDays returns the number of days between two timestamp.
func UnixDifferHours ¶
UnixDifferHours returns the number of hours between two timestamp.
func UnixToTime ¶
UnixToTime returns time.Time by unix timestamp.
Types ¶
type Snowflake ¶
Snowflake 定义一个Snowflake节点所需要的基本参数
func NewSnowflake ¶
NewSnowflake 实例化一个Snowflake节点