method

Value.CopyObject

Create a mutable copy of an object field map.

Example

go
seo := store.Object(store.Values{"title": store.String("Home")})
fields, ok := seo.CopyObject()
if ok {
  fields["title"] = store.String("Welcome")
  updated := store.Object(fields)
  fmt.Println(updated.Get("title"))
}

Returns

A detached field map and a boolean reporting whether the value is an object.

(Values, bool)

How it works

Child Values remain immutable. Use Get, Lookup or Entries when only reading.

Full signature

Related types

  • Value

    An immutable scalar, object, list, or populated document value.

  • Values

    A map of field names to typed values.

Related guides