Module: Cassie::Statements::Statement::Pagination::Cursors::ClassMethods

Defined in:
lib/cassie/statements/statement/pagination/cursors.rb

Instance Method Summary collapse

Instance Method Details

#cursor_by(key) ⇒ Object



38
39
40
41
# File 'lib/cassie/statements/statement/pagination/cursors.rb', line 38

def cursor_by(key)
  max_cursor key
  since_cursor key
end

#max_cursor(key) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cassie/statements/statement/pagination/cursors.rb', line 13

def max_cursor(key)
  include Cassie::Statements::Execution::Peeking
  self.partition_linker = Cassie::Statements::Execution::PartitionLinking::CursoringPolicy

  @max_cursor_key = key

  where(key,:lteq,
        value: :"max_#{key}",
        if: :max_cursor_enabled?)

  define_max_accessors(key)
end

#max_cursor_keyObject



43
44
45
# File 'lib/cassie/statements/statement/pagination/cursors.rb', line 43

def max_cursor_key
  @max_cursor_key.to_s
end

#since_cursor(key) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cassie/statements/statement/pagination/cursors.rb', line 26

def since_cursor(key)
  include Cassie::Statements::Execution::Peeking

  @max_cursor_key = key

  where(key, :gt,
        value: :"since_#{key}",
        if: :since_cursor_enabled?)

  define_since_accessors(key)
end