utils

package
v0.0.0-...-d7ebd13 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func AppPath

func AppPath() string

func Contains

func Contains(str string, substr string) bool

func Equals

func Equals(str1 string, str2 string) bool

func FloatToInt

func FloatToInt(v float64) int

*

  • float64 to int

func InArray

func InArray(value string, arr []string) bool

*

  • PHP-in_array()

func IntToString

func IntToString(v int) string

*

  • int to string

func Ip

func Ip(str string) bool

func IpAddr

func IpAddr(str string) bool

func IpV4

func IpV4(str string) bool

func IpV4Addr

func IpV4Addr(str string) bool

func IpV6

func IpV6(str string) bool

func IpV6Addr

func IpV6Addr(str string) bool

func IsDir

func IsDir(str string) bool

func IsEmail

func IsEmail(email string) bool

func IsFile

func IsFile(str string) bool

func IsMobile

func IsMobile(mobile string) bool

func IsNumeric

func IsNumeric(num int) bool

func IsURL

func IsURL(url string) bool

func IsUnique

func IsUnique(arr []rune) bool

func JsonToMap

func JsonToMap(jsonStr string) map[string]interface{}

*

  • json to map

func MapToJson

func MapToJson(obj map[string]interface{}) string

*

  • map to json

func Max

func Max(num int, max int) bool

func Md5

func Md5(str string) string

func Min

func Min(num int, max int) bool

func NotEqual

func NotEqual(str1 string, str2 string) bool

func OneOf

func OneOf(value interface{}, arr []rune) bool

func Required

func Required(str string) bool

func StringToInt

func StringToInt(str string) int

*

  • string to int

func StringToRuneArr

func StringToRuneArr(str string, lens int) []rune

*

  • 字符串转数组

func StructToMap

func StructToMap(obj interface{}) map[string]interface{}

*

  • struct / interface to map

func TcpAddr

func TcpAddr(str string) bool

func TcpV4Addr

func TcpV4Addr(str string) bool

func TcpV6Addr

func TcpV6Addr(str string) bool

func TypeOf

func TypeOf(v interface{}) string

*

  • 获取变量类型

func UdpAddr

func UdpAddr(str string) bool

func UdpV4Addr

func UdpV4Addr(str string) bool

func UdpV6Addr

func UdpV6Addr(str string) bool

Types

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (Time) String

func (t Time) String() string

*

  • String 格式化输出

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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