You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gorequest/common.go

25 lines
452 B

package gorequest
import (
"go.dtapp.net/gojson"
"go.dtapp.net/gostring"
"log"
)
// GetParamsString 获取参数字符串
func GetParamsString(src interface{}) string {
switch src.(type) {
case string:
return src.(string)
case int, int8, int32, int64:
case uint8, uint16, uint32, uint64:
case float32, float64:
return gostring.ToString(src)
}
data, err := gojson.Marshal(src)
if err != nil {
log.Fatal(err)
}
return string(data)
}