utils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Layout1 = "2006-01-02 15:04:06"
	Layout1 = "2006-01-02 15:04:06"
	// Layout2 = "20060102"
	Layout2 = "20060102"
)

Variables

This section is empty.

Functions

func ConvertStructToMap

func ConvertStructToMap(in interface{}) map[string]interface{}

ConvertStructToMap convert struct value into map[string]interface{}

func ConvertUint8Slice2String

func ConvertUint8Slice2String(u8s []uint8) string

ConvertUint8Slice2String ...

func CopyRequest

func CopyRequest(req *http.Request) *http.Request

CopyRequest means to copy a request for another handle-func or else

func CurTimeFormat

func CurTimeFormat(layout string) string

CurTimeFormat get current time string format value

func Decimal

func Decimal(val float64) float64

Decimal ... 1.0903920 to 1.09

func GetTimeDate

func GetTimeDate(t time.Time) time.Time

GetTimeDate 获取给定时间的日期整数

func GetTodayDate

func GetTodayDate() time.Time

GetTodayDate 获取今天的日期

func IsJSON

func IsJSON(s string) bool

IsJSON Judge a string is json string or not

func LoadJSONConfigFile

func LoadJSONConfigFile(filename string, v interface{}) error

LoadJSONConfigFile filename string

func LoadYamlConfigFile

func LoadYamlConfigFile(filename string, v interface{}) error

LoadYamlConfigFile need ?

func ParseFloat

func ParseFloat(s string) float64

ParseFloat ... parse float64's string into float64 "1.94" tobe 1.94

func ParseJSON

func ParseJSON(s string) map[string]interface{}

ParseJSON parse json string to map[string]interface{}

json string like: {"a":"a","b":"b"}

func ParseTime

func ParseTime(layout, value string) time.Time

ParseTime format time string into a time.Time with specified layout

func ParseURLQuery

func ParseURLQuery(query string) map[string]interface{}

ParseURLQuery parse url query string to map[string]interface{} k=v&a=1&b=2

func PostForm

func PostForm(URL string,
	data map[string]interface{},
) (map[string]interface{}, error)

PostForm http post (form) request

func ToLower

func ToLower(v interface{})

ToLower convert struct(only) fields to lower string if the field value is string type ~

Types

This section is empty.

Jump to

Keyboard shortcuts

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