Documentation ¶
Overview ¶
** description(""). ** copyright('tuoyun,www.tuoyun.net'). ** author("fg,Gordon@tuoyun.net"). ** time(2021/4/8 15:09).
** description(""). ** copyright('tuoyun,www.tuoyun.net'). ** author("fg,Gordon@tuoyun.net"). ** time(2021/2/22 11:52).
Index ¶
- Constants
- Variables
- func AesDecrypt(data []byte, key []byte) ([]byte, error)
- func AesEncrypt(data []byte, key []byte) ([]byte, error)
- func Base64Decode(data string) string
- func Base64Encode(data string) string
- func ByteSize(bytes uint64) string
- func CopyStructFields(a interface{}, b interface{}, fields ...string) (err error)
- func CorsHandler() gin.HandlerFunc
- func Difference(slice1, slice2 []uint32) []uint32
- func DifferenceString(slice1, slice2 []string) []string
- func GenSmallImage(src, dst string) error
- func GetConversationIDBySessionType(sourceID string, sessionType int) string
- func GetCurDayHalfTimeFormat() string
- func GetCurDayHalfTimestamp() int64
- func GetCurDayZeroTimeFormat() string
- func GetCurDayZeroTimestamp() int64
- func GetCurrentTimestampByMill() int64
- func GetCurrentTimestampByNano() int64
- func GetCurrentTimestampBySecond() int64
- func GetLocalIP() (string, error)
- func GetMsgID(sendID string) string
- func GetNewFileNameAndContentType(fileName string, fileType int) (string, string)
- func GetSelfFuncName() string
- func GetSwitchFromOptions(Options map[string]bool, key string) (result bool)
- func GetTimeStampByFormat(datetime string) string
- func Int32ToString(i int32) string
- func Int64ToString(i int64) string
- func IntToString(i int) string
- func InterfaceArrayToStringArray(data []interface{}) (i []string)
- func Intersect(slice1, slice2 []uint32) []uint32
- func IntersectString(slice1, slice2 []string) []string
- func IsContain(target string, List []string) bool
- func IsContainInt(target int, List []int) bool
- func IsContainInt32(target int32, List []int32) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func JsonStringToMap(str string) (tempMap map[string]int32)
- func JsonStringToStruct(s string, args interface{}) error
- func Map2Pb(m map[string]string) (pb proto.Message, err error)
- func MapIntToJsonString(param map[string]int32) string
- func MapToJsonString(param map[string]interface{}) string
- func Md5(s string, salt ...string) string
- func MkDir(path string) error
- func OperationIDGenerator() string
- func Pb2Map(pb proto.Message) (map[string]interface{}, error)
- func Pb2String(pb proto.Message) (string, error)
- func RemoveDuplicateElement(idList []string) []string
- func RemoveFromSlice(slice1, slice2 []string) []string
- func RemoveRepeatedStringInList(slc []string) []string
- func SetSwitchFromOptions(options map[string]bool, key string, value bool)
- func String2Pb(s string, pb proto.Message) error
- func StringToInt(i string) int
- func StringToInt32(i string) int32
- func StringToInt64(i string) int64
- func StructToJsonBytes(param interface{}) []byte
- func StructToJsonString(param interface{}) string
- func TimeStringFormatTimeUnix(timeFormat string, timeSrc string) int64
- func TimeStringToTime(timeString string) (time.Time, error)
- func TimeToString(t time.Time) string
- func Uint32ToString(i uint32) string
- func UnixMillSecondToTime(millSecond int64) time.Time
- func UnixNanoSecondToTime(nanoSecond int64) time.Time
- func UnixSecondToTime(second int64) time.Time
- func WithMessage(err error, message string) error
- func Wrap(err error, message string) error
- type Map
- func (m *Map) Del(key interface{})
- func (m *Map) Get(key interface{}) interface{}
- func (m *Map) Len() int
- func (m *Map) LockRange(f func(interface{}, interface{}))
- func (m *Map) RLockRange(f func(interface{}, interface{}))
- func (m *Map) Set(key interface{}, value interface{})
- func (m *Map) TestAndSet(key interface{}, value interface{}) interface{}
- func (m *Map) UnsafeDel(key interface{})
- func (m *Map) UnsafeGet(key interface{}) interface{}
- func (m *Map) UnsafeLen() int
- func (m *Map) UnsafeRange(f func(interface{}, interface{}))
- func (m *Map) UnsafeSet(key interface{}, value interface{})
Constants ¶
const ( BYTE = 1 << (10 * iota) KILOBYTE MEGABYTE GIGABYTE TERABYTE PETABYTE EXABYTE )
const ( TimeOffset = 8 * 3600 //8 hour offset HalfOffset = 12 * 3600 //Half-day hourly offset )
Variables ¶
var ServerIP = ""
Functions ¶
func Base64Decode ¶
func Base64Encode ¶
func CopyStructFields ¶
copy a by b b->a
func CorsHandler ¶
func CorsHandler() gin.HandlerFunc
func DifferenceString ¶
Get the diff of two slices
func GenSmallImage ¶
func GetCurDayHalfTimeFormat ¶
func GetCurDayHalfTimeFormat() string
Get the formatted time at 12 o'clock of the day, the format is "2006-01-02_12-00-00"
func GetCurDayHalfTimestamp ¶
func GetCurDayHalfTimestamp() int64
Get the timestamp at 12 o'clock on the day
func GetCurDayZeroTimeFormat ¶
func GetCurDayZeroTimeFormat() string
Get the formatted time at 0 o'clock of the day, the format is "2006-01-02_00-00-00"
func GetCurDayZeroTimestamp ¶
func GetCurDayZeroTimestamp() int64
Get the timestamp at 0 o'clock of the day
func GetCurrentTimestampByMill ¶
func GetCurrentTimestampByMill() int64
Get the current timestamp by Mill
func GetCurrentTimestampByNano ¶
func GetCurrentTimestampByNano() int64
Get the current timestamp by Nano
func GetCurrentTimestampBySecond ¶
func GetCurrentTimestampBySecond() int64
Get the current timestamp by Second
func GetLocalIP ¶
func GetSelfFuncName ¶
func GetSelfFuncName() string
func GetSwitchFromOptions ¶
func GetTimeStampByFormat ¶
func Int32ToString ¶
func Int64ToString ¶
func IntToString ¶
func InterfaceArrayToStringArray ¶
func InterfaceArrayToStringArray(data []interface{}) (i []string)
func IntersectString ¶
Get the intersection of two slices
func IsContainInt ¶
func IsContainInt32 ¶
func JsonStringToMap ¶
func JsonStringToStruct ¶
The incoming parameter must be a pointer
func MapIntToJsonString ¶
func MapToJsonString ¶
func OperationIDGenerator ¶
func OperationIDGenerator() string
func RemoveDuplicateElement ¶
func RemoveFromSlice ¶
func SetSwitchFromOptions ¶
func StringToInt ¶
func StringToInt32 ¶
func StringToInt64 ¶
func StructToJsonBytes ¶
func StructToJsonBytes(param interface{}) []byte
func StructToJsonString ¶
func StructToJsonString(param interface{}) string
func TimeToString ¶
func Uint32ToString ¶
func UnixMillSecondToTime ¶
func UnixNanoSecondToTime ¶
Convert nano timestamp to time.Time type
func UnixSecondToTime ¶
Convert timestamp to time.Time type
func WithMessage ¶
Types ¶
type Map ¶
func (*Map) RLockRange ¶
func (m *Map) RLockRange(f func(interface{}, interface{}))
func (*Map) TestAndSet ¶
func (m *Map) TestAndSet(key interface{}, value interface{}) interface{}
func (*Map) UnsafeRange ¶
func (m *Map) UnsafeRange(f func(interface{}, interface{}))