snowplow / snowbridge

For replicating streams across clouds, accounts and regions
Other
15 stars 7 forks source link

Configurable time layout in `epoch`/`epochMillis` JQ functions #378

Closed pondzix closed 1 week ago

pondzix commented 1 week ago

ref: PDP-1539

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:

In case of a string there are various time layouts that could be used for parsing. That's why epoch/epochMillis also accept (optional!) additional string parameter representing time layout. Layout must be valid go layout. Default value is 2006-01-02T15:04:05.999Z.