Documentation ¶
Index ¶
- Variables
- func CalculateContentMD5(data io.Reader, size int64) (string, error)
- func NewRequestId() string
- func NewUUID() string
- func SafeString(in interface{}) string
- func ToStringWithFunc(val interface{}, fbFn ToStringFunc) (str string, err error)
- func UriEncode(uri string, encodeSlash bool) string
- type ToStringFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConvType = errors.New("convert value type error")
View Source
var SprintToStrFunc = func(v interface{}) (string, error) { if v == nil { return "", nil } return fmt.Sprint(v), nil }
SprintToStrFunc convert any value to string by fmt.Sprint
Functions ¶
func NewRequestId ¶
func NewRequestId() string
func SafeString ¶
func SafeString(in interface{}) string
SafeString convert value to string, will ignore error
func ToStringWithFunc ¶
func ToStringWithFunc(val interface{}, fbFn ToStringFunc) (str string, err error)
ToStringWithFunc convert value to string, with a func to fallback handle.
On not convert:
- If fbFn is nil, will return ErrConvType.
- If fbFn is not nil, will call it to convert.
Types ¶
type ToStringFunc ¶
ToStringFunc try to convert value to string, return error on fail
Click to show internal directories.
Click to hide internal directories.