Documentation ¶
Overview ¶
Package object was forked from:
https://github.com/koding/koding/blob/4e0b75243e60685f3271838d2eb08bd3801fae48/go/src/koding/kites/kloud/utils/object/fix.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FixHCL ¶
func FixHCL(v interface{})
FixHCL is a best-effort method to "fix" value representation of HCL-encoded value, so it can be marshaled to a valid JSON.
hcl.Unmarshal encodes each object as []map[string]interface{}, and kloud expects JSON objects to not be wrapped in a 1-element slice.
This function converts []map[string]interface{} to map[string]interface{} if length of the slice is 1.
BUG(rjeczalik): This is going to break templates, which have legit 1-element []map[string]interface{} values.
func FixYAML ¶
func FixYAML(v interface{}) interface{}
FixYAML is a best-effort of fixing representation of YAML-encoded value, so it can be marshaled to a valid JSON.
YAML creates types like map[interface{}]interface{}, which are not a valid JSON types.
Related issue:
https://github.com/go-yaml/yaml/issues/139
func Merge ¶
Merge merges two objects into one.
If during merge any conflict is encountered, Merge fails with non-nil error that is of *MergeError type, which describes details of the conflict.
func SetFlatKeyValue ¶
Types ¶
type MergeError ¶
type MergeError struct { Path []string // object path starting at object root of conflicting element In interface{} // conflicting element in user's object Out interface{} // conflicting element in kloud's object }
MergeError is returned by Merge function on conflict during merging two object contents.
func (*MergeError) Error ¶
func (me *MergeError) Error() string
Error implements the builtin error interface.
Notes ¶
Bugs ¶
This is going to break templates, which have legit 1-element []map[string]interface{} values.