Documentation
¶
Index ¶
- func ArrayUnique(arr []string) (newArr []string)
- func CheckInternalIp(ip string) bool
- func CountWeek(TimeFormat string) int
- func Empty(value interface{}) bool
- func GetFloat(val interface{}) float64
- func GetInt(val interface{}) int
- func GetString(val interface{}) string
- func GetWeekday(TimeFormat string) string
- func InList(needle interface{}, haystack interface{}) bool
- func InListIndex(needle interface{}, haystack interface{}) int
- func Md5String(str string) string
- func ReadFile(path string) string
- func Round(f float64, n int) float64
- func StrToInt(str string) int
- func SubString(str string, begin, length int) (substr string)
- func ToBool(obj interface{}) bool
- func ToFloat(obj interface{}) float64
- func ToInt(obj interface{}) int
- func ToString(obj interface{}) string
- type Info
- func (info Info) Bool(key string) bool
- func (info Info) Float(key string) float64
- func (info Info) Info(key string) Info
- func (info Info) InfoList(key string) []Info
- func (info Info) Int(key string) int
- func (info Info) IsList(key string) bool
- func (info Info) Merge(source Info)
- func (info Info) String(key string) string
- func (info Info) ToString() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayUnique ¶
func CheckInternalIp ¶
*
判断内网IP A 10.0.0.0/8:10.0.0.0~10.255.255.255 B 172.16.0.0/12:172.16.0.0~172.31.255.255 C 192.168.0.0/16:192.168.0.0~192.168.255.255
*
func Empty ¶
func Empty(value interface{}) bool
判断一个数据是否为空,支持int, float, string, slice, array, map的判断
func GetFloat ¶
func GetFloat(val interface{}) float64
通过interface{}获取小数型数据 此获取比较灵活,转换规则如下 1、如果接收数据为浮点string,则将字符串转换为浮点数 2、如果接收数据是float型,则返回float数据 3、如果接收数据是int, int32, int64型,则转义成float类型 4、返回的数据结果统一为float64
func GetInt ¶
func GetInt(val interface{}) int
通过interface{}获取数值型数据 此获取比较灵活,转换规则如下 1、如果接收数据为浮点string,则返回浮点数的整数部分,如果是整型string,则返回整数,如果是纯字符串,则返回0 2、如果接收数据是float型,则返回float的整数部分 3、如果接收数据是int, int32, int64型,则返回int
func GetWeekday ¶
func InList ¶
func InList(needle interface{}, haystack interface{}) bool
判断某一个值是否在列表(支持 slice, array, map)中
func InListIndex ¶
func InListIndex(needle interface{}, haystack interface{}) int
返回某一个值是否在列表位置(支持 slice, array, map) -1为不再列表中
func ToFloat ¶
func ToFloat(obj interface{}) float64
*
- 对象转换为float64
- 支持类型:int,float64,string,bool(true:1;false:0)
- 其他类型报错
Types ¶
Click to show internal directories.
Click to hide internal directories.