Documentation ¶
Index ¶
- func BytesToString(b []byte) string
- func ConcatString(s ...string) string
- func FileExists(path string) bool
- func GenShortID() (string, error)
- func GetBytes(key interface{}) ([]byte, error)
- func GetDate() string
- func GetHostname() string
- func GetInternalIP() string
- func GetLocalIP() string
- func GetShowTime(ts time.Time) string
- func GetTodayDateInt() int
- func IsEmpty(s string) bool
- func IsInSlice(value interface{}, sli interface{}) bool
- func IsZero(i ...interface{}) bool
- func JoinInt(is []int64) string
- func Md5(str string) (string, error)
- func RandomStr(n int) string
- func RegexpReplace(reg, src, temp string) string
- func RemoveDuplicateElement(slice []string) []string
- func SliceShuffle(slice []interface{})
- func SplitInt(s string) ([]int64, error)
- func StrInArray(str string, strArr []string) bool
- func StringSliceContains(ss []string, s string) bool
- func StringSliceEqual(a, b []string) bool
- func StringSliceReflectEqual(a, b []string) bool
- func StringToBytes(s string) []byte
- func StringToInt(str string) (int, error)
- func StringToInt64(str string) (int64, error)
- func StringToUint64(str string) (uint64, error)
- func TimeLayout() string
- func TimeToShortString(ts time.Time) string
- func TimeToString(ts time.Time) string
- func Uint64DeleteElemInSlice(i int, s []uint64) []uint64
- func Uint64DeleteElemInSliceWithOrder(i int, s []uint64) []uint64
- func Uint64ShuffleSlice(a []uint64) []uint64
- func Uint64SliceReverse(a []uint64) []uint64
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConcatString ¶
ConcatString 连接字符串 NOTE: 性能比fmt.Sprintf和+号要好
func FileExists ¶
func IsInSlice ¶
func IsInSlice(value interface{}, sli interface{}) bool
IsInSlice 判断某一值是否在slice中 因为使用了反射,所以时间开销比较大,使用中根据实际情况进行选择
func RemoveDuplicateElement ¶
func StrInArray ¶
func StringSliceContains ¶
StringSliceContains 字符串切片中是否包含另一个字符串 来自go源码 net/http/server.go
func StringSliceEqual ¶
StringSliceEqual 判断 string和slice 是否相等 使用了传统的遍历方式
func StringSliceReflectEqual ¶
StringSliceReflectEqual 判断 string和slice 是否相等 因为使用了反射,所以效率较低,可以看benchmark结果
func Uint64DeleteElemInSlice ¶
Uint64DeleteElemInSlice 从slice删除元素 fast version, 会改变顺序 i:slice的索引值 s: slice
func Uint64DeleteElemInSliceWithOrder ¶
Uint64DeleteElemInSliceWithOrder 从slice删除元素 slow version, 保持原有顺序 i:slice的索引值 s: slice
func Uint64ShuffleSlice ¶
Uint64ShuffleSlice 对slice进行随机
func Uint64SliceReverse ¶
Uint64SliceReverse 对uint64 slice 反转
Types ¶
type Pagination ¶
Pagination 分页器
func NewPagination ¶
func NewPagination(req *http.Request, total int, pageSize int) *Pagination
NewPagination 新建分页器
Source Files ¶
Click to show internal directories.
Click to hide internal directories.