utils

package
v0.0.0-...-c2450c0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const Key_login_id = "login_id"
View Source
const Key_login_phone = "login_phone"
View Source
const Key_res = "login_res"
View Source
const TokenEncoderString = "123TEST"

Variables

View Source
var Yuan int = 100

Functions

func CheckLoginToken

func CheckLoginToken(req *url.Values, outOfTime *time.Duration) error

登录用户插入login_phone,login_id

func CheckVersionValue

func CheckVersionValue(query UrlValue, writer http.ResponseWriter) (int, error)

检查是否有version

func ConvertField

func ConvertField(arg interface{}, args ...Convert) error

func ConvertToVOs

func ConvertToVOs(vos interface{}, fields interface{})

func CountHash4

func CountHash4(v string) string

func CountMethodTps

func CountMethodTps(total float64, now time.Time, info string)

调用次方法 必须加上 defer 关键字!

func CountMethodUseTime

func CountMethodUseTime(now time.Time, info string, duration time.Duration)

调用次方法 必须加上 defer 关键字!

func CreateExcelFile

func CreateExcelFile(Create func(xlsx *excelize.File), out io.Writer)

func CreateRechargeTime

func CreateRechargeTime(createTime time.Time, TotalPayTime int, month int) string

func CreateUUID

func CreateUUID() string

func CronScan

func CronScan(it interface{}, c *cron.Cron)

扫描结构体指针

func DateId

func DateId() string

func DateIdInt64

func DateIdInt64() int64

func DecodeDateString

func DecodeDateString(arg string) *time.Time

func DecodeTimeString

func DecodeTimeString(arg string) *time.Time

func DurationToString

func DurationToString(duration time.Duration) string

func Export

func Export(dto ExportDTO, out io.Writer)

func GetIds

func GetIds(arg interface{}, field string) []string

arg array or struct

func HttpPost

func HttpPost(url string, args url.Values) ([]byte, error)

func JsonFunc

func JsonFunc(argFunc func(writer http.ResponseWriter, request *http.Request) interface{}) func(writer http.ResponseWriter, request *http.Request)

func NewOutPut

func NewOutPut(logpath string) io.Writer

func PrintTimeString

func PrintTimeString(info string, start time.Time, end time.Time, duration time.Duration) string

func SetExcelCellValue

func SetExcelCellValue(xlsx *excelize.File, x int, y int, obj interface{})

func Sign

func Sign(data jwt.MapClaims, secret string) string

func StartTimer

func StartTimer(startType StartType, exeType ExecuteType, d time.Duration, fn func())

启动Timer,调用它请不要使用 go 关键字,内部已经使用协程处理

func ToAlphaString

func ToAlphaString(value int) string

func ToDigitString

func ToDigitString(bytess []byte) string

func VerifyToken

func VerifyToken(input string, secret string) (jwt.Claims, error)

func YuanToFen

func YuanToFen(arg int) int

Types

type Convert

type Convert struct {
	// contains filtered or unexported fields
}

func (Convert) New

func (it Convert) New(mapKey string, setFieldName string, Map interface{}) Convert

type ExcelTitle

type ExcelTitle struct {
	Title  string
	Field  string
	Format func(arg interface{}) interface{}
}

type ExecuteType

type ExecuteType int
const (
	Execute_Default ExecuteType = iota
	Execute_coroutine
)

type ExportDTO

type ExportDTO struct {
	Titles    []ExcelTitle
	DataArray interface{}
}

type MyWrite

type MyWrite struct {
	// contains filtered or unexported fields
}

func (*MyWrite) Write

func (it *MyWrite) Write(p []byte) (n int, err error)

type StartType

type StartType int
const (
	StartType_Wait StartType = iota
	StartType_Now
)

type UrlValue

type UrlValue struct {
	*url.Values
}

func ParserUrlValues

func ParserUrlValues(request *http.Request) UrlValue

func (*UrlValue) GetFloat

func (it *UrlValue) GetFloat(k string, def float64) float64

func (*UrlValue) GetInt

func (it *UrlValue) GetInt(k string, def int) int

func (UrlValue) GetString

func (it UrlValue) GetString(k string) string

Jump to

Keyboard shortcuts

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