Module: WeaviateRecord::Queries::Offset

Included in:
Relation
Defined in:
lib/weaviate_record/queries/offset.rb

Overview

This module contains function to offset Weaviate records

Instance Method Summary collapse

Instance Method Details

#offset(offset_value) ⇒ Object

Offset the number of records to be fetched from the database

Example:

Article.count #=> 10
articles = Article.offset(5)
articles.size #=> 5

Raises:

  • (TypeError)


13
14
15
16
17
18
19
# File 'lib/weaviate_record/queries/offset.rb', line 13

def offset(offset_value)
  raise TypeError, 'Offset should be an integer' unless offset_value.to_i.to_s == offset_value.to_s

  @offset = offset_value
  @loaded = false
  self
end