class Relix::Query

Public Class Methods

new(model) click to toggle source
# File lib/relix/query.rb, line 3
def initialize(model)
  @model = model
  @offset = 0
end

Public Instance Methods

[](index_name) click to toggle source
# File lib/relix/query.rb, line 8
def [](index_name)
  index = @model[index_name]
  raise MissingIndexError.new("No index declared for #{index_name}") unless index
  @clause = index.create_query_clause(@model.redis)
end
run() click to toggle source
# File lib/relix/query.rb, line 14
def run
  if @clause
    @clause.lookup
  else
    @model.primary_key_index.lookup
  end
end