method

Value.CopyList

Create a mutable slice containing the list items.

Example

go
tags := store.List(store.String("news"))
items, ok := tags.CopyList()
if ok {
  items = append(items, store.String("go"))
  tags = store.List(items...)
}

Returns

A detached slice and a boolean reporting whether the value is a list.

([]Value, bool)

How it works

Child Values remain immutable. Use Elements or ListItem for reads, and WithListItem for a single replacement.

Full signature

func (value Value) CopyList() ( []Value, bool, )

Source store/value.go:109

Related types

  • Value

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

Related guides