Documentation
¶
Index ¶
- Constants
- Variables
- func BJsonToListMap(bdata []byte) (jmap []map[string]interface{})
- func BJsonToMap(bdata []byte) (jmap map[string]interface{})
- func Bind(data interface{}, ret interface{}) error
- func CheckIp(ipAddr string) bool
- func EndWith(value, str string) bool
- func FileOpenRead(filename string) (contents []uint8, err error)
- func Float64ToStr(obj float64) (sli string)
- func Formattimezone() string
- func FromTimeStamp(in interface{}) string
- func GetYesterdayTime() []string
- func If(b bool, to, fo interface{}) interface{}
- func InToMap(b []interface{}) []map[string]interface{}
- func IntToStr(in int) string
- func InterToSliceString(obj interface{}) []string
- func InterfaceToBool(x interface{}) bool
- func InterfaceToFloat64(x interface{}) float64
- func InterfaceToInt(x interface{}) int
- func InterfaceToInt32(x interface{}) int32
- func InterfaceToInt64(x interface{}) int64
- func InterfaceToStr(x interface{}) string
- func IsLeapYear(year int) bool
- func IterToMap(obj interface{}) map[string]interface{}
- func IterToMaps(obj interface{}) []map[string]interface{}
- func JoinRedisKey(key ...string) string
- func JsonNumberToFloat64(obj json.Number) float64
- func JsonNumberToInt64(obj json.Number) int64
- func LastDuration() (sTime, eTime string)
- func ListMaxVal(list []int) (maxval int)
- func ListMaxValInt(slice interface{}) (maxIndex, minIndex int, maxVal, minVal, avgVal float64)
- func ListStructToListMap(obj []interface{}) []map[string]interface{}
- func MapArrToObjArr(old []map[string]interface{}) []interface{}
- func MapToBuffer(m interface{}) *bytes.Buffer
- func MapToStr(param map[string]interface{}) string
- func MapToString(m interface{}) string
- func MatToBuffer(m map[string]interface{}) *bytes.Buffer
- func MathCeil(x float64) int
- func MathFloor(x float64) int
- func PathExists(path string) (bool, error)
- func Pretty(data interface{}) string
- func RangeKeyListMap(obj interface{}, list []map[string]interface{}) bool
- func RangeListMap(obj map[string]interface{}, list []map[string]interface{}) bool
- func RangeMap(obj interface{}, list map[string]interface{}) bool
- func Rangelist(b interface{}, list []interface{}) bool
- func ReadFile(filename string) (string, error)
- func Readlines(filename string) (readlineslist []string, err error)
- func RemoveDuplicatesAndEmpty(a []string) (ret []string)
- func RemoveRepeatedElement(arr []string) (newArr []string)
- func RemoveRepeatedElementList(arr []interface{}) (newArr []interface{})
- func SJsonToListMap(sdata string) (jmap []map[string]interface{})
- func SJsonToMap(sdata string) (jmap map[string]interface{})
- func Set(in interface{}, out interface{})
- func SetListString(list1, list2 []string) []string
- func SetListStringadd(list1, list2 []string) (listAdd []string)
- func SliceInterToString(obj []interface{}) (sli []string)
- func SliceToStr(v interface{}) string
- func SortData(data interface{}, sortkey string, reverse bool)
- func SortDataEx(data interface{}, sortkey []string, reverse bool)
- func SortedMap(mapslice []map[string]interface{}, sortkey string, direction bool) []map[string]interface{}
- func StartWith(value, str string) bool
- func StrToInt(in string) int
- func StrToMap(str string) map[string]interface{}
- func StringToFloat64(obj string) float64
- func StringToInt(obj string) int
- func StringToInt64(obj string) int64
- func StringToMap(str string) (jmap map[string]interface{})
- func StringToSlice(s string) []string
- func StructToMap(obj interface{}) map[string]interface{}
- func StructToMapMore(obj interface{}) map[string]interface{}
- func StructToMapMore1(obj interface{}) map[string][]map[string]interface{}
- func ToInt(x interface{}) int
- func ToSlice(arr interface{}) []interface{}
- func ToString(i interface{}) string
- func ToTimeStamp(in string) int64
- func UnixToTime(t, typ int64) (sTime string)
- func VerifyEmailFormat(email string) bool
- func WriteFile(filename string, data []byte) error
- type Cloud_env_Get
- type SaveDebug
- type SendData
- type SortBy
- type SortByEx
Constants ¶
View Source
const ( LicenseLoginFileName = "/etc/service/license/license_login.conf" // 正式版本路径 UptimeFile = "/proc/uptime" //linux ////////// POST = "POST" GET = "GET" HEAD = "HEAD" PUT = "PUT" DELETE = "DELETE" PATCH = "PATCH" OPTIONS = "OPTIONS" )
Variables ¶
View Source
var ( // int 强制转换 Int = InterfaceToInt Int64 = InterfaceToInt64 Int32 = InterfaceToInt32 // float 强制转换 Float64 = InterfaceToFloat64 // string 强制转换 Str = InterfaceToStr // bool 强制转换 Bool = InterfaceToBool )
View Source
var TFormat = "2006-01-02" // 默认时间戳转字符串格式
View Source
var TimeFormat = "2006-01-02 15:04:05" // 默认时间戳转字符串格式
View Source
var TimeFormatRexMap = map[string]string{ `^[+|-]\d{4}\s\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$`: "-0700 2006-01-02 15:04:05", `^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$`: "2006-01-02 15:04:05", `^\d{4}/\d{2}/\d{2}\s\d{2}:\d{2}:\d{2}[+|-]\d{4}$`: "2006/01/02 15:04:05-0700", `^\d{4}/\d{2}/\d{2}T\d{2}:\d{2}:\d{2}[+|-]\d{4}$`: "2006/01/02T15:04:05-0700", `^\d{4}/\d{2}/\d{2}\s\d{2}:\d{2}:\d{2}$`: "2006/01/02 15:04:05", `^\d{4}/\d{2}/\d{2}T\d{2}:\d{2}:\d{2}$`: "2006/01/02T15:04:05", } // 字符串转时间戳匹配模式
Functions ¶
func BJsonToListMap ¶
将切片类型的json流byte 转换成map切片
func FromTimeStamp ¶
func FromTimeStamp(in interface{}) string
func InToMap ¶
func InToMap(b []interface{}) []map[string]interface{}
[]interface to []map[string]interface{}
func InterfaceToBool ¶
func InterfaceToBool(x interface{}) bool
func InterfaceToFloat64 ¶
func InterfaceToFloat64(x interface{}) float64
func InterfaceToInt ¶
func InterfaceToInt(x interface{}) int
func InterfaceToInt32 ¶
func InterfaceToInt32(x interface{}) int32
func InterfaceToStr ¶
func InterfaceToStr(x interface{}) string
func IterToMaps ¶
func IterToMaps(obj interface{}) []map[string]interface{}
func JoinRedisKey ¶
func JsonNumberToInt64 ¶
json.Number to int64 json.Number转换int64
func ListMaxVal ¶
func ListMaxValInt ¶
获取一个数组里最大值,并且拿到下标
func ListStructToListMap ¶
func ListStructToListMap(obj []interface{}) []map[string]interface{}
[]struct to []map[string]interface{}
func RangeKeyListMap ¶
判断map切片是否存在一个key
func RangeListMap ¶
range []map[string]interface{}判断map是否存在一个列表中
func RemoveRepeatedElementList ¶
func RemoveRepeatedElementList(arr []interface{}) (newArr []interface{})
去重列表内容
func SJsonToListMap ¶
将切片json流字符串 转换成map切片
func SetListStringadd ¶
对两个切片字符串去重并合并
func SliceInterToString ¶
func SliceInterToString(obj []interface{}) (sli []string)
将切片 interface转成切片字符串
func SliceToStr ¶
func SliceToStr(v interface{}) string
func SortData ¶
根据指定字符排序
m := []map[string]int{
{"k": 2},
{"k": 1},
{"k": 3},
}
customer.SortData(&m, "k", true) ture 倒序3, 2, 1 fmt.Println(m)
func SortDataEx ¶
func SortedMap ¶
func SortedMap(mapslice []map[string]interface{}, sortkey string, direction bool) []map[string]interface{}
对切片map排序 冒泡排序 mapslice 需要排序的map类型的切片 ,sortkey,排序key键关键字 , direction true为递增排序false为递减排序
func StringToSlice ¶
func StructToMapMore1 ¶
struct 转map
Types ¶
type Cloud_env_Get ¶
获取公共平台访问地址、端口类型设定
type SaveDebug ¶
type SaveDebug struct {
UserID string `json:"user_id" bson:"user_id" form:"user_id" query:"user_id" validate:"user_id"`
UserRole string `json:"user_role" bson:"user_role" form:"user_role" query:"user_role" validate:"user_role"`
ClientIp string `json:"client_ip" bson:"client_ip" form:"client_ip" query:"client_ip" validate:"client_ip"`
Optype string `json:"optype" bson:"optype" form:"optype" query:"optype" validate:"optype"`
Content interface{} `json:"content" bson:"content" form:"content" query:"content" validate:"content"`
Ret interface{} `json:"ret" bson:"ret" form:"ret" query:"ret" validate:"ret"`
Time int `json:"time" bson:"time" form:"time" query:"time" validate:"time"`
ErrorMsg string `json:"error_msg" bson:"error_msg" form:"error_msg" query:"error_msg" validate:"error_msg"`
}
全局
type SendData ¶
type SendData struct {
Success bool `json:"success" bson:"success"`
Ret interface{} `json:"ret" bson:"ret"`
}
全局通用 返回请求数据strcut
Click to show internal directories.
Click to hide internal directories.