util

package
v0.0.0-...-654d6e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayHave

func ArrayHave(items []string, item string) bool

func CamelCaseToUdnderscore

func CamelCaseToUdnderscore(s string) string

驼峰单词转下划线单词

func ExecShell

func ExecShell(s string) (string, error)

阻塞式的执行外部shell命令的函数,等待执行完毕并返回标准输出

func FileExists

func FileExists(path string) bool

func GetIp

func GetIp() string

func GetType

func GetType(params interface{}) string

GetType : 获取数据类型字符串 (string, int, float64, []int, []string, map[string]int ...) GetType : (能不用则不用,由于涉及到使用reflect包,性能堪忧)

func InArray

func InArray(needle interface{}, hystack interface{}) bool

InArray :给定元素值 是否在 指定的数组中

func Int2Time

func Int2Time(ts int64) *time.Time

numToTime 时间戳转time ,注意是否纳秒

func IntPtr

func IntPtr(s int) *int

转为string指针

func Ip2long

func Ip2long(ipstr string) (ip uint32)

func IsEmpty

func IsEmpty(params interface{}) bool

判断是否为空 0, nil ,"", 空数组 = true

func IsEmptyStr

func IsEmptyStr(params string) bool

空字符串 返回true 否则返回 false

func Long2ip

func Long2ip(ip uint32) string

func MicrosecondsStr

func MicrosecondsStr(latency time.Duration) int64

微秒 0.001.001

func RemoteIp

func RemoteIp(req *http.Request) string

获取请求中的IP

func Str2Time

func Str2Time(str string) *time.Time

StrToTime 字符串转time

func StrToInt

func StrToInt(str string) int

StrToInt string 转int

func StrToInt64

func StrToInt64(str string) int64

StrToInt string 转int64

func StrToUInt

func StrToUInt(str string) uint

StrToUInt string 转uint

func Strct2Slice

func Strct2Slice(f interface{}, sheetFieldsJson []string) []interface{}

struct 转 切片

func StringPtr

func StringPtr(s string) *string

转为int指针

func Stru2map

func Stru2map(content interface{}) map[string]interface{}

struct转map

func Ternary

func Ternary(a bool, b, c interface{}) interface{}

三目运算函数

func TimeToStr

func TimeToStr(t *time.Time) string

获取 20160102150405 格式

func ToLower

func ToLower(s string) string

单词全部转化为小写

func ToUpper

func ToUpper(s string) string

单词全部转化为大写

func UderscoreToLowerCamelCase

func UderscoreToLowerCamelCase(s string) string

下划线单词转为小写驼峰单词

func UderscoreToUpperCamelCase

func UderscoreToUpperCamelCase(s string) string

下划线单词转为大写驼峰单词

func UrlQueryStrToMap

func UrlQueryStrToMap(urlstr string) (map[string]interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL