util

package module
v0.0.0-...-13c8884 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	X_MinuteSec   int64 = 60
	X_HourSec     int64 = 60 * 60         // hour sec
	X_DaySec      int64 = X_HourSec * 24  // day sec
	X_DayMilliSec int64 = X_DaySec * 1000 // day millisec

	X_TimeZone_ModSec int64 = X_HourSec * 8 // 8 hours
)

////////////////////////////////////////////////////////////////////////////

Variables

This section is empty.

Functions

func CurMillisecond

func CurMillisecond() int64

////////////////////////////////////////////////////////////////////////////

func DrainChannel

func DrainChannel(ch reflect.Value, expire time.Time) bool

DrainChannel waits for the channel to finish emptying (draining) for up to the expiration. It returns true if the drain completed (the channel is empty), false otherwise.

func Duplicate

func Duplicate(src interface{}, dst interface{}) error

只能复制Public字段

func Perm

func Perm(n int32) []int32

参考: rand.Perm

func PermArray

func PermArray(array []int32) []int32

把数组打乱顺序

func ProcTime

func ProcTime(t string) (int64, bool)

func ToJsonBytes

func ToJsonBytes(v interface{}) []byte

func ToJsonString

func ToJsonString(v interface{}) string

func ToObj

func ToObj(b []byte, dst interface{}) error

func ToValues

func ToValues(vs ...interface{}) []reflect.Value

//////////////////////////////////////////////////////////////////////////////

Types

This section is empty.

Directories

Path Synopsis
caches
tempcache
有有效期的cache:每条记录有单独到有效期, 获取记录时判断是否有效, 失效则重新获取
有有效期的cache:每条记录有单独到有效期, 获取记录时判断是否有效, 失效则重新获取
timercache
定时更新cache: 每类cache有一个更新时间, 到期后, 整体更新该类数据
定时更新cache: 每类cache有一个更新时间, 到期后, 整体更新该类数据
计数器: 调用自增接口时, 如果与记录中key相同则增加记录中计数, 否则重新计数 例: 限制每分钟(秒钟)接口访问次数, 以时间为参数调用自增接口, 根据返回值判断是否到上限
计数器: 调用自增接口时, 如果与记录中key相同则增加记录中计数, 否则重新计数 例: 限制每分钟(秒钟)接口访问次数, 以时间为参数调用自增接口, 根据返回值判断是否到上限
dbs
mgo
* Create by SunXiguang 2018-12-28 Desc: mongodb命令定义
* Create by SunXiguang 2018-12-28 Desc: mongodb命令定义
redis
redis命令常量定义
redis命令常量定义
redis/redix
redis常用接口封装
redis常用接口封装
读取本地配置文件.
读取本地配置文件.
Package lru implements an LRU cache.
Package lru implements an LRU cache.
net
协程安全的list(对contain/list进行封装)
协程安全的list(对contain/list进行封装)
字符串和数字排序 1.如果能转成数字, 则转成数字比较;2.数字排在字符串前;3.升序排列
字符串和数字排序 1.如果能转成数字, 则转成数字比较;2.数字排在字符串前;3.升序排列
zips
zk配置,需要外部进行初始化
zk配置,需要外部进行初始化

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL