MCPcopy
hub / github.com/cloudfoundry/cli / NewOptionalObject

Function NewOptionalObject

types/optional_object.go:14–25  ·  view source on GitHub ↗
(v map[string]interface{})

Source from the content-addressed store, hash-verified

12}
13
14func NewOptionalObject(v map[string]interface{}) OptionalObject {
15 if v == nil {
16 // This ensures that when IsSet==true, we always have an empty map as the value which
17 // marshals to `{}` and not a nil map which marshals to `null`
18 v = make(map[string]interface{})
19 }
20
21 return OptionalObject{
22 IsSet: true,
23 Value: v,
24 }
25}
26
27func (o *OptionalObject) UnmarshalJSON(rawJSON []byte) error {
28 var receiver map[string]interface{}

Calls

no outgoing calls

Tested by

no test coverage detected