GreenFairy.CQL.Scalars.DateTime.PeriodUnit (GreenFairy v0.3.0)

View Source

Enum for time period units in date/time filtering.

Used with _period and _current_period operators to specify the granularity of time-based filtering.

Values

  • :hour - Hour period
  • :day - Day period
  • :week - Week period (Monday to Sunday by default, configurable)
  • :month - Calendar month period
  • :quarter - Quarter period (3 months: Q1=Jan-Mar, Q2=Apr-Jun, Q3=Jul-Sep, Q4=Oct-Dec)
  • :year - Calendar year period

Examples

# Current week
%{unit: :week}

# Last 30 days
%{direction: :last, unit: :day, count: 30}

# This quarter
%{unit: :quarter}

Summary

Functions

Transform an Ecto/database value to its GraphQL enum representation.

Transform a GraphQL enum value to its Ecto/database representation.

Functions

parse(value)

Transform an Ecto/database value to its GraphQL enum representation.

Default implementation returns the value unchanged. Override this function to provide custom transformations.

serialize(value)

Transform a GraphQL enum value to its Ecto/database representation.

Default implementation returns the value unchanged. Override this function to provide custom transformations.