-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configurable time layout in
epoch
/epochMillis
JQ functions
Before this commit `epoch`-like functions required `time.Time` type on input. It worked well for atomic Snowplow fields like `collector_tstamp`. It becomes problematic when some nested context fields representing time are passed. Such fields don't use `time.Time`, they are plain strings. This commit makes `epoch`/`epochMillis` functions more flexible: * When input is `time.Time` - just use it as is (atomic fields). * When input is a string - try to parse it as `time.Time`. * When input is something different - return an error. In case of a string there are various time layouts that could be used for parsing. That's why `epoch`/`epochMillis` also accept additional string parameter representing time layout. Layout must be valid [GO layout](https://pkg.go.dev/time#pkg-constants). Default value is `2006-01-02T15:04:05.999Z`.
- Loading branch information
Showing
3 changed files
with
104 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters