Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayCopy(src []interface{}) (dst []interface{})
- func InterfaceEquals(criteria interface{}, existing interface{}) bool
- func InterfacePrint(m interface{}, printToConsole bool)
- func InterfaceToJsonString(i interface{}) string
- func IterateFieldsInInterface(in interface{}, callback FieldIterFunc) error
- func IterateMapsInInterface(in interface{}, callback MapIterFunc) error
- func JsonToYaml(in []byte) ([]byte, error)
- func MapAdd(dst map[string]interface{}, src map[string]interface{}) map[string]interface{}
- func MapCombine(dst map[string]interface{}, src map[string]interface{}) map[string]interface{}
- func MapCopy(src map[string]interface{}) map[string]interface{}
- func MapInterfaceToMapString(src map[string]interface{}) map[string]string
- func MapIsCompatible(big map[string]interface{}, small map[string]interface{}) bool
- func MapReplace(dst map[string]interface{}, src map[string]interface{}) map[string]interface{}
- func MarshalJsonIndentNoEscape(i interface{}) ([]byte, error)
- func NewError(errType int, str string) error
- func NewFileLogger(path string) *log.Logger
- func NewLogger(out io.Writer) *log.Logger
- func NewStdLogger() *log.Logger
- func TimeCompare(v1 interface{}, v2 interface{}) bool
- func YamlObjToJsonObj(in interface{}) (interface{}, error)
- func YamlToJson(in []byte) (json.RawMessage, error)
- type Error
- type FieldIterFunc
- type MapIterFunc
- type TypedError
Constants ¶
const ( ErrOK = iota // 0 ErrInvalid // invalid parameters ErrNotFound // resource not found ErrExpect // the REST result doesn't match the expected value ErrHttp // Http request failed ErrServerResp // unexpected server response ErrInternal // unexpected internal error (meqa error) )
Variables ¶
var Logger *log.Logger
There is only one logger per process.
var Verbose bool
Whether verbose mose is on
Functions ¶
func InterfaceEquals ¶
func InterfaceEquals(criteria interface{}, existing interface{}) bool
Check if existing matches criteria. When criteria is a map, we check whether everything in criteria can be found and equals a field in existing.
func InterfacePrint ¶
func InterfacePrint(m interface{}, printToConsole bool)
func InterfaceToJsonString ¶
func InterfaceToJsonString(i interface{}) string
func IterateFieldsInInterface ¶
func IterateFieldsInInterface(in interface{}, callback FieldIterFunc) error
func IterateMapsInInterface ¶
func IterateMapsInInterface(in interface{}, callback MapIterFunc) error
Iterate all the leaf level fields. For maps iterate all the fields. For arrays we will go through all the entries and see if any of them is a map. The iteration will be done in a width first order, so deeply buried fields will be iterated last. The maps should be map[string]interface{}.
func JsonToYaml ¶
func MapCombine ¶
MapCombine combines two map together. If there is any overlap the dst will be overwritten.
func MapInterfaceToMapString ¶
MapInterfaceToMapString converts the params map (all primitive types with exception of array) before passing to resty.
func MapIsCompatible ¶
MapIsCompatible checks if the first map has every key in the second.
func MapReplace ¶
MapReplace replaces the values in dst with the ones in src with the matching keys.
func NewFileLogger ¶
func NewStdLogger ¶
func TimeCompare ¶
func TimeCompare(v1 interface{}, v2 interface{}) bool
func YamlObjToJsonObj ¶
func YamlObjToJsonObj(in interface{}) (interface{}, error)
func YamlToJson ¶
func YamlToJson(in []byte) (json.RawMessage, error)
Given a yaml stream, output a json stream.
Types ¶
type FieldIterFunc ¶
type MapIterFunc ¶
type TypedError ¶
type TypedError struct {
// contains filtered or unexported fields
}
TypedError holds a type and a back trace for easy debugging
func (*TypedError) Error ¶
func (e *TypedError) Error() string
func (*TypedError) Type ¶
func (e *TypedError) Type() int