Module: ActiveHll::Model
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_hll/model.rb
Instance Method Summary collapse
-
#hll_add(attributes) ⇒ Object
doesn’t update in-memory record attribute for performance.
- #hll_count(attribute) ⇒ Object
Instance Method Details
#hll_add(attributes) ⇒ Object
doesn’t update in-memory record attribute for performance
92 93 94 95 |
# File 'lib/active_hll/model.rb', line 92 def hll_add(attributes) self.class.where(id: id).hll_add(attributes) nil end |
#hll_count(attribute) ⇒ Object
97 98 99 100 101 102 |
# File 'lib/active_hll/model.rb', line 97 def hll_count(attribute) Utils.with_connection(self.class) do |connection| quoted_column = connection.quote_column_name(attribute) self.class.where(id: id).pluck("hll_cardinality(#{quoted_column})").first || 0.0 end end |