View Source Plausible.Stats.Fragments (Plausible v0.0.1)

Summary

Functions

Converts time or date and time to the specified timezone.

Returns the weekstart for date. If the weekstart is before the not_before boundary, not_before is returned.

Same as Plausible.Stats.Fragments.weekstart_not_before/2 but converts dates to the specified timezone.

Functions

Link to this macro

coalesce_string(fieldA, fieldB)

View Source (macro)
Link to this macro

sample_percent()

View Source (macro)
Link to this macro

to_timezone(date, timezone)

View Source (macro)

Converts time or date and time to the specified timezone.

Reference: https://clickhouse.com/docs/en/sql-reference/functions/date-time-functions/#totimezone

Link to this macro

visit_duration()

View Source (macro)
Link to this macro

weekstart_not_before(date, not_before)

View Source (macro)

Returns the weekstart for date. If the weekstart is before the not_before boundary, not_before is returned.

Examples

In this pseudo-code example, the fragment returns the weekstart. The not_before boundary is set to the past Saturday, which is before the weekstart, therefore the cap does not apply.

iex> this_wednesday = ~D[2022-11-09] ...> past_saturday = ~D[2022-11-05] ...> weekstart_not_before(this_wednesday, past_saturday) ~D[2022-11-07]

In this other example, the fragment returns Tuesday and not the weekstart. The not_before boundary is set to Tuesday, which is past the weekstart, therefore the cap applies.

iex> this_wednesday = ~D[2022-11-09] ...> this_tuesday = ~D[2022-11-08] ...> weekstart_not_before(this_wednesday, this_tuesday) ~D[2022-11-08]

Link to this macro

weekstart_not_before(date, not_before, timezone)

View Source (macro)

Same as Plausible.Stats.Fragments.weekstart_not_before/2 but converts dates to the specified timezone.