thedevsaddam / gojsonq

A simple Go package to Query over JSON/YAML/XML/CSV Data
https://github.com/thedevsaddam/gojsonq/wiki
MIT License
2.17k stars 140 forks source link

Add Date Support #74

Open bhinners opened 4 years ago

bhinners commented 4 years ago

Looks great. I'm eager to start trying it out.

One thing I'll need soon, though, is support for dates. Basically, in addition to int, string, bool or slice in Where expressions, I need to be able to use dates. Somehow (tbd), I would expect to specify the format of the date string which would apply to both the string I pass as val to Where as well as what I'm expecting to be found in the JSON. Ideally, this format could be any of the predefined layouts supported by time.Parse. The Where op arguments would need to be extended to support the equivalents of time.After, time.Before and time.Equal. Finally, I need a way to traverse a JSON collection in chronological order or at a minimum pull the first or last chronologically from a collection. E.g. date-aware variations on Sort and SortBy would suffice.