Documentation
¶
Index ¶
- type Query
- func (q *Query) ArrayFieldStrings(selector string, field string) []string
- func (q *Query) ArrayLength() int
- func (q *Query) Contains(selector string) bool
- func (q *Query) Int32(selector string) int
- func (q *Query) IsArray() bool
- func (q *Query) Raw(selector string) []byte
- func (q *Query) String(selector string) string
- func (q *Query) Strings(selector string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is a JSON query interface
func (*Query) ArrayFieldStrings ¶ added in v0.34.0
ArrayFieldStrings iterates the JSON array at selector and extracts the named field from each object element, returning the values as a string slice. Returns nil if the selector doesn't exist or the value is not an array.
func (*Query) ArrayLength ¶ added in v0.9.0
ArrayLength returns number of elements in the array
func (*Query) Int32 ¶ added in v0.10.0
Int32 returns a integer value from the json object based on its selector
func (*Query) Raw ¶ added in v0.34.0
Raw returns the raw JSON bytes at the given dot-notation selector, or nil if not found.
func (*Query) Strings ¶ added in v0.34.0
Strings returns a slice of strings at the given selector. If the value is a JSON array of strings, each element is returned. If the value is a single string, a one-element slice is returned. Returns nil if the selector doesn't exist or the value is not a string/array.