class Sleek::Queries::CountUnique

Internal: Count unique query.

Counts how many events have unique value for a given property.

target_property - the String name of target property on event.

Examples

sleek.queries.count_unique(:purchases, target_property: "customer.email")
# => 4

Public Instance Methods

perform(events) click to toggle source
# File lib/sleek/queries/count_unique.rb, line 16
def perform(events)
  events.distinct(target_property).count
end