SelectoComponents.Helpers.BucketParser (selecto_components v0.4.5)

Parser for bucket range specifications like "1, 2-5, 6-14, 15+" and numeric increment shorthand like "*/10"

Link to this section Summary

Link to this section Functions

Link to this function

exclude_articles?(value, default \\ true)

Link to this function

generate_bucket_case_sql(field_name, bucket_ranges, field_type \\ :integer)

Generate SQL CASE expression for bucketing values

Link to this function

generate_bucket_filter(field_name, bucket_label, bucket_ranges)

Generate filter for a specific bucket

Link to this function

generate_text_prefix_case_sql(field_name, opts \\ %{})

Generate SQL CASE expression for text prefix buckets.

Example buckets with default options:

  • "The Office" -> "OF"
  • "A Team" -> "TE"
  • nil/blank/article-only -> "Other"
Link to this function

get_bucket_labels(bucket_ranges)

Get bucket labels in order for column headers

Link to this function

ignore_case?(value, default \\ true)

Link to this function

normalized_text_sql(field_name, opts \\ %{})

Build normalized SQL text expression for prefix bucketing/filtering.

Link to this function

parse_bucket_ranges(ranges_string)

Link to this function

parse_prefix_length(value, default \\ 2)

Link to this function

qualify_field_name(field_name)