Documentation ¶
Index ¶
- Variables
- func AppendMapIfExists(condition bool, des map[string]interface{}, key string, value interface{})
- func Bool(s bool) *bool
- func BoolR(s *bool) bool
- func Cause(err error) error
- func Contains(s []interface{}, e interface{}) bool
- func ConvertBool(value string) bool
- func ConvertInt(value string) int
- func ConvertInt32(value string) int32
- func ConvertUint8(value string) uint8
- func Delete(slice []string, place int) []string
- func EqualAsJSON(t *testing.T, expected, actual interface{}, args ...interface{})
- func ErrorFatal(err error)
- func ErrorWrap(err error, wrap string) error
- func Find(slice []string, val string) (int, bool)
- func Float32(s float32) *float32
- func Float32R(s *float32) float32
- func Float64(s float64) *float64
- func Float64R(s *float64) float64
- func GetFloat32(values map[interface{}]interface{}, key interface{}) (float32, error)
- func GetFloat32Default(values map[interface{}]interface{}, key interface{}, defaultValue float32) float32
- func GetFloat64(values map[interface{}]interface{}, key interface{}) (float64, error)
- func GetFloat64Default(values map[interface{}]interface{}, key interface{}, defaultValue float64) float64
- func GetInt(values map[interface{}]interface{}, key interface{}) (int, error)
- func GetInt32(values map[interface{}]interface{}, key interface{}) (int32, error)
- func GetInt32Default(values map[interface{}]interface{}, key interface{}, defaultValue int32) int32
- func GetInt64(values map[interface{}]interface{}, key interface{}) (int64, error)
- func GetInt64Default(values map[interface{}]interface{}, key interface{}, defaultValue int64) int64
- func GetIntDefault(values map[interface{}]interface{}, key interface{}, defaultValue int) int
- func GetInterfaceIP() string
- func GetString(values map[interface{}]interface{}, key interface{}) (string, error)
- func GetStringDefault(values map[interface{}]interface{}, key interface{}, defaultValue string) string
- func GetStringSlice(values map[interface{}]interface{}, key interface{}) ([]string, error)
- func GetStringSliceDefault(values map[interface{}]interface{}, key interface{}, defaultValue []string) []string
- func GetTime(values map[interface{}]interface{}, key interface{}) (time.Time, error)
- func GetenvDefault(key string, def string) string
- func HelpMessage() string
- func Int(s int) *int
- func Int32(s int32) *int32
- func Int32R(s *int32) int32
- func Int64(s int64) *int64
- func Int64R(s *int64) int64
- func IntNullCheck(value int) bool
- func IntR(s *int) int
- func IsLocalIP(ip string) bool
- func KeyStringToInterface(i map[string]interface{}) map[interface{}]interface{}
- func MapToStruct(to interface{}, tag string, from interface{}) error
- func Profile() interface{ ... }
- func String(s string) *string
- func StringNullCheck(value string) bool
- func StringR(s *string) string
- func ToJSONMap(i interface{}) interface{}
- type DebugCarrier
- type DetailsCarrier
- type Error
- type Future
- type ReasonCarrier
- type RequestIDCarrier
- type StackTracer
- type StatusCarrier
- type StatusCodeCarrier
Constants ¶
This section is empty.
Variables ¶
var ErrKeyCanNotBeTypeAsserted = errors.New("key could not be type asserted")
ErrKeyCanNotBeTypeAsserted is returned when the key can not be type asserted.
var ErrKeyDoesNotExist = errors.New("key is not present in map")
ErrKeyDoesNotExist is returned when the key does not exist in the map.
Functions ¶
func AppendMapIfExists ¶
func Cause ¶ added in v0.3.0
Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements the following interface:
type causer interface { Cause() error }
If the error does not implement Cause, the original error will be returned. If the error is nil, nil will be returned without further investigation.
func ConvertBool ¶
func ConvertInt ¶
func ConvertInt32 ¶
func ConvertUint8 ¶
func EqualAsJSON ¶ added in v0.3.0
func ErrorFatal ¶
func ErrorFatal(err error)
func GetFloat32 ¶ added in v0.3.0
GetFloat32 returns a float32 for a given key in values.
func GetFloat32Default ¶ added in v0.3.0
func GetFloat32Default(values map[interface{}]interface{}, key interface{}, defaultValue float32) float32
GetFloat32Default returns a float32 or the default value for a given key in values.
func GetFloat64 ¶ added in v0.3.0
GetFloat64 returns a float64 for a given key in values.
func GetFloat64Default ¶ added in v0.3.0
func GetFloat64Default(values map[interface{}]interface{}, key interface{}, defaultValue float64) float64
GetFloat64Default returns a float64 or the default value for a given key in values.
func GetInt32Default ¶ added in v0.3.0
GetInt32Default returns a int32 or the default value for a given key in values.
func GetInt64Default ¶ added in v0.3.0
GetInt64Default returns a int64 or the default value for a given key in values.
func GetIntDefault ¶ added in v0.3.0
GetIntDefault returns a int or the default value for a given key in values.
func GetInterfaceIP ¶
func GetInterfaceIP() string
func GetStringDefault ¶ added in v0.3.0
func GetStringDefault(values map[interface{}]interface{}, key interface{}, defaultValue string) string
GetStringDefault returns a string or the default value for a given key in values.
func GetStringSlice ¶ added in v0.3.0
GetStringSlice returns a string slice for a given key in values.
func GetStringSliceDefault ¶ added in v0.3.0
func GetStringSliceDefault(values map[interface{}]interface{}, key interface{}, defaultValue []string) []string
GetStringSliceDefault returns a string slice or the default value for a given key in values.
func GetenvDefault ¶ added in v0.3.0
GetenvDefault returns an environment variable or the default value if it is empty.
func HelpMessage ¶ added in v0.3.0
func HelpMessage() string
HelpMessage returns a string explaining how profiling works.
func IntNullCheck ¶
func KeyStringToInterface ¶ added in v0.3.0
func KeyStringToInterface(i map[string]interface{}) map[interface{}]interface{}
KeyStringToInterface converts map[string]interface{} to map[interface{}]interface{}
func MapToStruct ¶
func Profile ¶ added in v0.3.0
func Profile() interface { Stop() }
Profile parses the PROFILING environment variable and executes the proper profiling task.
func StringNullCheck ¶
Types ¶
type DebugCarrier ¶ added in v0.3.0
type DebugCarrier interface { // Debug returns debugging information for the error, if applicable. Debug() string }
DebugCarrier can be implemented by an error to support error contexts.
type DetailsCarrier ¶ added in v0.3.0
type DetailsCarrier interface { // Details returns details on the error, if applicable. Details() map[string]interface{} }
DetailsCarrier can be implemented by an error to support error contexts.
type ReasonCarrier ¶ added in v0.3.0
type ReasonCarrier interface { // Reason returns the reason for the error, if applicable. Reason() string }
ReasonCarrier can be implemented by an error to support error contexts.
type RequestIDCarrier ¶ added in v0.3.0
type RequestIDCarrier interface { // RequestID returns the ID of the request that caused the error, if applicable. RequestID() string }
RequestIDCarrier can be implemented by an error to support error contexts.
type StackTracer ¶ added in v0.3.0
type StackTracer interface {
StackTrace() errors.StackTrace
}
type StatusCarrier ¶ added in v0.3.0
type StatusCarrier interface { // ID returns the error id, if applicable. Status() string }
StatusCarrier can be implemented by an error to support error contexts.
type StatusCodeCarrier ¶ added in v0.3.0
type StatusCodeCarrier interface { // StatusCode returns the status code of this error. StatusCode() int }
StatusCodeCarrier can be implemented by an error to support setting status codes in the error itself.