Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONArraySubset ¶
JSONArraySubset generates a new JSON array adding the field selector defined values only for each array element. Returns error if the provided JSON string is not valid JSON array.
func JSONSubset ¶
JSONSubset generates a new JSON object adding the field selector defined values only. For JSON Arrays use the JSONArraySubset function. Returns error if the provided JSON string is not valid JSON object.
For field selector parsing to set of JSON pointers is used SelectorToJSONPointers utility. For example: 1. "attributes/model,attributes/location", would select only model and location attribute values (if present) 2. "attributes(model,location)" would select only model and location attribute values (if present) 3. "features/feature1/properties(city,street) would select from city and street values inside properties inside feature1 of features (if present) 4. "features(feature1/properties,feature1,feature2/properties/country(city,street),feature2)" would select only properties inside feature1 inside feature and city and street inside country inside properties inside feature2 inside features. Note that feature1 and feature2 inside features will not be selected.
func SelectorToJSONPointers ¶
SelectorToJSONPointers returns array of the JSON pointers (https://tools.ietf.org/html/rfc6901) for a given fields selector string.
Rule example:
- thingId,attributes/model,attributes/location and thingId,attributes(model,location), would return the same array:
[
/thingId, /attributes/model, /attributes/location,
] 2. features/feature1/properties(city,street), would return array: [
/features/feature1/properties/city, /features/feature1/properties/street,
] 3. features(feature1/properties,feature1,feature2/properties/country(city,street),feature2), would return array, including only most inner paths: [
/features/feature1/properties, /features/feature2/properties/country/city, /features/feature2/properties/country/street,
], i.e. features/feature1 and features/feature2 are not returned.
Types ¶
This section is empty.