_utils

package
v0.0.0-...-054b70b Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSepIfNeeded

func AddSepIfNeeded(pth string) string

func Base64Decode

func Base64Decode(str string) string

*

  • base64 解码
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func CWD

func CWD() string

当前目录

func DeepCopy

func DeepCopy(dst, src interface{}) error

func EXEName

func EXEName() string

func ErrorLogFilename

func ErrorLogFilename() string

func GetExeDir

func GetExeDir() string

func GetRandomString

func GetRandomString(n int) string

生成随机字符串

func HashPassword

func HashPassword(pwd string) string

func InArrayS

func InArrayS(items []string, s string) bool

InArrayS 如果 s 在 items 中,返回 true;否则,返回 false。

func IsPortInUse

func IsPortInUse(port int) bool

func LocalIP

func LocalIP() string

本机 ip

func LogDir

func LogDir() string

func MD5

func MD5(str string) string

md5

func ParseFlostToString

func ParseFlostToString(f float64) string

*

  • 转换浮点数为string
  • @method func
  • @param {[type]} t * Tools [description]
  • @return {[type]} [description]

func ParseInt

func ParseInt(b string, defInt int) int

*

  • string转换int
  • @method parseInt
  • @param {[type]} b string [description]
  • @return {[type]} [description]

func ParseString

func ParseString(b int) string

*

  • int转换string
  • @method parseInt
  • @param {[type]} b string [description]
  • @return {[type]} [description]

func PrintUsage

func PrintUsage()

func ReadResData

func ReadResData(path string) string

func StructToMap

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

*

  • 结构体转换成map对象
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func StructToString

func StructToString(data interface{}) string

*

  • 结构体转成json 字符串
  • @method StruckToString
  • @param {[type]} data interface{} [description]

func SubString

func SubString(str string, start, length int) string

*

  • 字符串截取
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func TimeFormat

func TimeFormat(time *time.Time) string

*

  • 时间格式化
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func UnitJoin

func UnitJoin(ss []uint, sep string) string

连接 unit slice 为字符串

func WorkInDir

func WorkInDir(f func(), dir string)

func WwwPath

func WwwPath() string

Types

type GeneratePhoneNumber

type GeneratePhoneNumber struct {
	CacheData []string
}

func (*GeneratePhoneNumber) CreatePhoneNumber

func (*GeneratePhoneNumber) CreatePhoneNumber() string

生成随机手机号码

func (*GeneratePhoneNumber) CreateUniquePhoneNumber

func (g *GeneratePhoneNumber) CreateUniquePhoneNumber() string

生成唯一随机手机号码

type Request

type Request struct {
	PageSize int `json:"pageSize"`
	PageNo   int `json:"pageNo"`
	Aa       int `json:"aa"`
}

type Response

type Response struct {
	Code int64       `json:"code"`
	Msg  interface{} `json:"message"`
	Data interface{} `json:"data"`
}

func ApiRes

func ApiRes(code int64, msg string, objects interface{}) (r *Response)

type ResponsePage

type ResponsePage struct {
	Response

	PageSize   int   `json:"pageSize"`
	PageNo     int   `json:"pageNo"`
	TotalCount int64 `json:"totalCount"`
	TotalPage  int64 `json:"totalPage"`
}

func ApiResPage

func ApiResPage(code int64, msg string, objects interface{}, pageNo, pageSize int, total int64) (r *ResponsePage)

Jump to

Keyboard shortcuts

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