Documentation ¶
Overview ¶
Package commonpath contains functions used for path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindValues ¶
FindValues returns values by path, looking up into arrays.
It iterates path elements, at each path element it adds to next values to iterate:
- if it is a document and has path, it adds the document field value to next values;
- if it is an array, FindArrayIndex is true and finds value at index, it adds value to next values;
- if it is an array, FindArrayDocuments is true and documents in the array have path, it adds field value of all documents that have path to next values.
It returns next values after iterating path elements.
Types ¶
type FindValuesOpts ¶
type FindValuesOpts struct { // If FindArrayDocuments is true, it iterates the array to find documents that have path. // If FindArrayDocuments is false, it does not find documents from the array. // Using path `v.foo` and `v` is an array: // - with FindArrayDocuments true, it finds values of `foo` of found documents; // - with FindArrayDocuments false, it returns an empty array. // If `v` is not an array, FindArrayDocuments has no impact. FindArrayDocuments bool // If FindArrayIndex is true, it finds value at index of an array. // If FindArrayIndex is false, it does not find value at index of an array. // Using path `v.0` and `v` is an array: // - with FindArrayIndex true, it finds 0-th index value of the array; // - with FindArrayIndex false, it returns empty array. // If `v` is not an array, FindArrayIndex has no impact. FindArrayIndex bool }
FindValuesOpts sets options for FindValues.
Click to show internal directories.
Click to hide internal directories.