Documentation ¶
Overview ¶
加密处理
字符串处理
Index ¶
- func Base64Decode(src string) ([]byte, error)
- func Base64Encode(src []byte) string
- func CamelCaseToUnderscore(name string) string
- func Datetime(sec int64, format ...string) string
- func DiffDays(to, from time.Time) int
- func ExecCmd(dir string, name string, args ...string) (string, error)
- func ExistFolder(folder string) bool
- func FormatDate(t time.Time) string
- func FormatDatetime(t time.Time) string
- func FormatTime(t time.Time) string
- func GenRandStr(length int) (string, error)
- func GetCacheName(prefix string, tags ...interface{}) string
- func GetFirstDateOfMonth(d time.Time) time.Time
- func GetHttpRealIP(r *http.Request) string
- func GetLastDateOfMonth(d time.Time) time.Time
- func GetRandom(min, max int64) int64
- func GetRandomN(min, max, n int64) []int64
- func GetZeroTime(d time.Time) time.Time
- func InFloat32Slice(v float32, sl []float32) bool
- func InFloat64Slice(v float64, sl []float64) bool
- func InInt32Slice(v int32, sl []int32) bool
- func InInt64Slice(v int64, sl []int64) bool
- func InIntSlice(v int, sl []int) bool
- func InSlice(v interface{}, slice interface{}) bool
- func InStrSlice(v string, sl []string) bool
- func InitFolder(folder string, perm ...os.FileMode) error
- func Int32SliceUnique(slice []int32) (uniqueslice []int32)
- func Int64SliceIface(slice []int64) (result []interface{})
- func Int64SliceUnique(slice []int64) (uniqueslice []int64)
- func IntSliceIface(slice []int) (result []interface{})
- func IsSameDay(t1, t2 time.Time) bool
- func IsSameMonth(t1, t2 time.Time) bool
- func IsSameYear(t1, t2 time.Time) bool
- func Md5(str string) string
- func MkFolder(folder string, perm ...os.FileMode) error
- func MonthTime() time.Time
- func RandSlice(slice interface{})
- func RandomHit(hit float64, double ...int64) bool
- func Sha256(str string) string
- func SliceChunk(slice []interface{}, size int) (chunkslice [][]interface{})
- func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{})
- func SliceFilter(slice []interface{}, a filtertype) (ftslice []interface{})
- func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{})
- func SliceMerge(slice1, slice2 []interface{}) (c []interface{})
- func SlicePad(slice []interface{}, size int, val interface{}) []interface{}
- func SliceRand(a []interface{}) (b interface{})
- func SliceRandList(min, max int) []int
- func SliceRandStr(a []string) (b string)
- func SliceRange(start, end, step int64) (intslice []int64)
- func SliceReduce(slice []interface{}, a reducetype) (dslice []interface{})
- func SliceShuffle(slice []interface{}) []interface{}
- func SliceShuffleInt(slice []int) []int
- func SliceSum(intslice []int64) (sum int64)
- func SliceUnique(slice []interface{}) (uniqueslice []interface{})
- func SplitStrSlice(str string, sep string) []interface{}
- func StrSliceIface(slice []string) (result []interface{})
- func StrSliceUnique(slice []string) (uniqueslice []string)
- func StrToTime(datetime, format string) (time.Time, error)
- func StrToUnix(datetime string, format ...string) int64
- func StructToByte(data interface{}) []byte
- func TimeDayBegin(t time.Time) time.Time
- func TimeDayHour(t time.Time, hour int) time.Time
- func TimeFindWeekDay(t time.Time, whichWeek int, whichWDay time.Weekday) time.Time
- func TimeFormat(t time.Time, format string) string
- func TimeMonthBegin(t time.Time) time.Time
- func TimeMonthEnd(t time.Time) time.Time
- func TimeRFindWeekDay(t time.Time, whichWeek int, whichWDay time.Weekday) time.Time
- func TimeToMinute(u int64) int64
- func TimeToStrSlice(u int64) []string
- func TimeUnix() int64
- func TimeUnixMill() int64
- func TimeUnixNano() int64
- func TimeWeekBegin(t time.Time) time.Time
- func TimeWeekEnd(t time.Time) time.Time
- func TodayTime() time.Time
- func UUID() string
- func UUID1() string
- func UnderscoreToCamelCase(name string) string
- func UnixToTime(sec int64) time.Time
- func Valid() *validate
- func WeekEndTime() time.Time
- func WeekTime() time.Time
- type Counter
- type Int32Slice
- type Int64Slice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCacheName ¶
GetCacheName 生成缓存名称
func GetFirstDateOfMonth ¶
获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
func GetLastDateOfMonth ¶
获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。
func GetRandomN ¶
GetRandomN 在指定范围内生成N个不重复的随机数 min ≤ rnd ≤ max(如果数据超过10000, 不建议使用)
func InFloat32Slice ¶
InInt64Slice checks given int64 in int64 slice or not.
func InFloat64Slice ¶
InInt64Slice checks given int64 in int64 slice or not.
func InInt32Slice ¶
InInt32Slice checks given int in int slice or not.
func InInt64Slice ¶
InInt64Slice checks given int64 in int64 slice or not.
func InIntSlice ¶
InIntSlice checks given int in int slice or not.
func InSlice ¶
func InSlice(v interface{}, slice interface{}) bool
InSlice checks given interface in interface slice.
func InStrSlice ¶
InStrSlice checks given string in string slice or not.
func Int32SliceUnique ¶
Int32SliceUnique cleans repeated values in slice.
func Int64SliceIface ¶
func Int64SliceIface(slice []int64) (result []interface{})
Int64SliceIface 数字切片转 []interface{}
func Int64SliceUnique ¶
Int64SliceUnique cleans repeated values in slice.
func IntSliceIface ¶
func IntSliceIface(slice []int) (result []interface{})
IntSliceIface 数字切片转 []interface{}
func SliceChunk ¶
func SliceChunk(slice []interface{}, size int) (chunkslice [][]interface{})
SliceChunk separates one slice to some sized slice.
func SliceDiff ¶
func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{})
SliceDiff returns diff slice of slice1 - slice2.
func SliceFilter ¶
func SliceFilter(slice []interface{}, a filtertype) (ftslice []interface{})
SliceFilter generates a new slice after filter function.
func SliceIntersect ¶
func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{})
SliceIntersect returns slice that are present in all the slice1 and slice2.
func SliceMerge ¶
func SliceMerge(slice1, slice2 []interface{}) (c []interface{})
SliceMerge merges interface slices to one slice.
func SlicePad ¶
func SlicePad(slice []interface{}, size int, val interface{}) []interface{}
SlicePad prepends size number of val into slice.
func SliceRand ¶
func SliceRand(a []interface{}) (b interface{})
SliceRand returns random one from slice.
func SliceRandList ¶
SliceRandList generate an int slice from min to max.
func SliceRandStr ¶
SliceRand returns random one from slice.
func SliceRange ¶
SliceRange generates a new slice from begin to end with step duration of int64 number.
func SliceReduce ¶
func SliceReduce(slice []interface{}, a reducetype) (dslice []interface{})
SliceReduce generates a new slice after parsing every value by reduce function
func SliceShuffle ¶
func SliceShuffle(slice []interface{}) []interface{}
SliceShuffle shuffles a slice.
func SliceShuffleInt ¶
SliceShuffleInt shuffles a int slice.
func SliceUnique ¶
func SliceUnique(slice []interface{}) (uniqueslice []interface{})
SliceUnique cleans repeated values in slice.
func StrSliceIface ¶
func StrSliceIface(slice []string) (result []interface{})
StrSliceIface 字符串切片转 []interface{}
func StrSliceUnique ¶
StrSliceUnique cleans repeated values in slice.
func StructToByte ¶
func StructToByte(data interface{}) []byte
StructToByte 将结构体转为字节码 取值使用 *(**interface{})(unsafe.Pointer(&bytes)) 方式, 把 interface{} 替换成原结构体类型
func TimeFindWeekDay ¶
取指定月的第X个周Y日期
func TimeRFindWeekDay ¶
取指定月的倒数第X个周Y日期
Types ¶
type Int32Slice ¶
type Int32Slice []int32
Int32Slice attaches the methods of Interface to []int, sorting in increasing order.
func (Int32Slice) Len ¶
func (p Int32Slice) Len() int
func (Int32Slice) Less ¶
func (p Int32Slice) Less(i, j int) bool
func (Int32Slice) Swap ¶
func (p Int32Slice) Swap(i, j int)
type Int64Slice ¶
type Int64Slice []int64
Int64Slice attaches the methods of Interface to []int, sorting in increasing order.
func (Int64Slice) Len ¶
func (p Int64Slice) Len() int
func (Int64Slice) Less ¶
func (p Int64Slice) Less(i, j int) bool
func (Int64Slice) Swap ¶
func (p Int64Slice) Swap(i, j int)