util

package
v0.0.0-...-fd86128 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseConvert

func BaseConvert(number int, fromBase int8, toBase int8) (string, error)

BaseConvert TODO

func DateStrToTime

func DateStrToTime(v string) time.Time

func DateTimeStrToTime

func DateTimeStrToTime(v string) time.Time

func FormatDurationToStr

func FormatDurationToStr(d int64) string

func FormatFloat

func FormatFloat(num float64, decimal int) string

func FormatTimeToString

func FormatTimeToString(t int32) string

800=>08:00

func HTTPGet

func HTTPGet(uri string) ([]byte, error)

HTTPGet get 请求

func HTTPPost

func HTTPPost(uri string, data string) ([]byte, error)

HTTPPost post 请求

func InArray

func InArray(val interface{}, list interface{}) bool

func P

func P(vals ...interface{})

func PMap

func PMap(location int, val map[string]interface{})

func PP

func PP(location int, val interface{})

func PostFile

func PostFile(fieldname, filename, uri string) ([]byte, error)

PostFile 上传文件

func PostJSON

func PostJSON(uri string, obj interface{}) ([]byte, error)

PostJSON post json 数据请求

func PostJSONWithRespContentType

func PostJSONWithRespContentType(uri string, obj interface{}) ([]byte, string, error)

PostJSONWithRespContentType post json数据请求,且返回数据类型

func PostMultipartForm

func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)

PostMultipartForm 上传文件或其他多个字段

func PostXML

func PostXML(uri string, obj interface{}) ([]byte, error)

PostXML perform a HTTP/POST request with XML body

func PostXMLWithTLS

func PostXMLWithTLS(uri string, obj interface{}, ca, key string) ([]byte, error)

PostXMLWithTLS perform a HTTP/POST request with XML body and TLS

func PriceDbToExport

func PriceDbToExport(dbPrice int32) (resPrice string)

func PriceExportToDb

func PriceExportToDb(exportPrice string) int32

func ScoreDbToExport

func ScoreDbToExport(score int32) string

func StrToTimeInt

func StrToTimeInt(v string) int64

func TimeIntToDateTimeStr

func TimeIntToDateTimeStr(t int64) string

func TimeToDate

func TimeToDate(t time.Time) string

秒级时间戳=>日期

func TimeToDateTime

func TimeToDateTime(t time.Time) string

func TimeToExportWeekDay

func TimeToExportWeekDay(t time.Time) string

周X

func Val2int

func Val2int(val interface{}) int

func Val2int64

func Val2int64(val interface{}) int64

func Val2string

func Val2string(val interface{}) string

Types

type MultipartFormField

type MultipartFormField struct {
	IsFile    bool
	Fieldname string
	Value     []byte
	Filename  string
}

MultipartFormField 保存文件或其他字段信息

Jump to

Keyboard shortcuts

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