Documentation ¶
Index ¶
- func DecodeBase64(src []byte) ([]byte, error)
- func DecodeBase64String(str string) ([]byte, error)
- func EncodeBase64(src []byte) []byte
- func EncodeBase64ToString(src []byte) string
- func HandleCrash(additionalHandlers ...func(interface{}))
- func HandleCrashSilent(additionalHandlers ...func(interface{}))
- func MarshalJSON(v interface{}) ([]byte, error)
- func NormalizePath(path string) (string, error)
- func ToBool(i interface{}, d ...bool) bool
- func ToDuration(i interface{}, d ...time.Duration) time.Duration
- func ToInt(i interface{}, d ...int) int
- func ToInterfaceSlice(i interface{}) []interface{}
- func ToString(i interface{}, d ...string) string
- func ToStringInterfaceMap(i interface{}) map[string]interface{}
- func ToStringSlice(i interface{}) []string
- func ToStringStringMap(i interface{}) map[string]string
- func TryMarshalJSON(v interface{}) []byte
- func TryUnmarshalJSON(data []byte, v interface{})
- func UnmarshalJSON(data []byte, v interface{}) error
- func UnsafeBytesToString(bs []byte) string
- func UnsafeStringToBytes(s string) (bytes []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64 ¶
DecodeBase64 decodes the input bytes, which can accept padded or none padded format.
func DecodeBase64String ¶
DecodeBase64String decodes the input string, which can accept padded or none padded format.
func EncodeBase64 ¶
EncodeBase64 encodes the input bytes, and then output standard format.
func EncodeBase64ToString ¶
EncodeBase64ToString encodes the input bytes, and then output standard format string.
func HandleCrash ¶
func HandleCrash(additionalHandlers ...func(interface{}))
HandleCrash handles the crash with a default log handler.
func HandleCrashSilent ¶
func HandleCrashSilent(additionalHandlers ...func(interface{}))
HandleCrashSilent handles the crash without the default log handler.
func MarshalJSON ¶
MarshalJSON encodes the input object as JSON.
func NormalizePath ¶
NormalizePath returns an absolute path of given path.
func ToDuration ¶ added in v0.0.4
ToDuration tries to convert an interface to `time.Duration`.
func ToInterfaceSlice ¶ added in v0.0.3
func ToInterfaceSlice(i interface{}) []interface{}
ToInterfaceSlice tries to convert an interface to `[]interface`.
func ToStringInterfaceMap ¶ added in v0.0.3
func ToStringInterfaceMap(i interface{}) map[string]interface{}
ToStringInterfaceMap tries to convert an interface to `map[string]interface{}`.
func ToStringSlice ¶
func ToStringSlice(i interface{}) []string
ToStringSlice tries to convert an interface to `[]string`.
func ToStringStringMap ¶ added in v0.0.3
ToStringStringMap tries to convert an interface to `map[string]string`.
func TryMarshalJSON ¶
func TryMarshalJSON(v interface{}) []byte
TryMarshalJson is the same as MarshalJSON but doesn't return error.
func TryUnmarshalJSON ¶
func TryUnmarshalJSON(data []byte, v interface{})
TryUnmarshalJSON is the same as UnmarshalJSON but doesn't return error.
func UnmarshalJSON ¶
UnmarshalJSON decodes the input JSON into the input handler.
func UnsafeBytesToString ¶
func UnsafeStringToBytes ¶
Types ¶
This section is empty.