You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Additional examples can be found in [tests/tests.rs](tests/tests.rs).
162
164
165
+
## Filtering
166
+
167
+
pco_store generates a `Filter` struct to specify read-time filters. Required fields from `group_by` and `fingerprint` will be filtered in SQL before the data is decompressed, but other fields can be filtered after decompression but before the data is returned to the caller as an optimization to avoid pointless allocations.
168
+
169
+
Timestamps are accepted as an inclusive range (with precision automatically truncated to microseconds), and all other fields are accepted as an array to check for inclusion in that array.
170
+
171
+
### Creating a filter
172
+
173
+
-`Filter::new()` is a shorthand to set the required fields from `group_by` and `timestamp`
174
+
- Optional filters can be set as fields on the struct: `filter.fingerprint = vec![1]`
175
+
- Struct literal syntax can also be used: `Filter { fingerprint: vec![1], ..Filter::default() }`
176
+
177
+
### Filter deserialization using serde
178
+
179
+
Non-timestamp fields can be passed either as an array, or as a single value which is automatically wrapped in an array.
180
+
181
+
Timestamps support multiple formats:
182
+
-`["ts1", "ts2"]`: an array with two timestamps becomes an inclusive range `ts1..=ts2`
183
+
-`["ts1"]`: an array with a single timestamp becomes an inclusive range `ts1..=ts1`
184
+
-`"ts1"`: a single timestamp becomes an inclusive range `ts1..=ts1`
185
+
186
+
### Filter convenience functions
187
+
188
+
-`range_bounds` returns the time range lower and upper bounds
189
+
-`range_duration` returns the duration of the filter's time range
190
+
-`range_shift` mutably shifts the time range's start and end by a certain amount, e.g. to filter for "today, 7 days ago"
191
+
163
192
## Contributions are welcome to
164
193
165
194
- support decompression of only the fields requested at runtime
0 commit comments