function

NewPath

Validate and build a path from segments computed at run time.

Example

go
authorEmail, err := query.NewPath("author", "email")
if err != nil {
  return err
}

Arguments

ArgumentTypeDescription
segments[]stringThe segments value.

Returns

The declared result.

(Path, error)

How it works

For a name written in your code, pass the string, such as "seo.title", to a filter helper instead.

Full signature

func NewPath(segments ...string) (Path, error)

Source query/path.go:59

Related types

  • Path

    An immutable, validated document field path.

Related guides