Module: WeaviateRecord::Queries::Limit

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

Overview

This module contains functions to perform limit query

Instance Method Summary collapse

Instance Method Details

#limit(limit_value) ⇒ Object

Limit the number of records to be fetched from the database

Example:

articles = Article.limit(5)
articles.size #=> 5

Raises:

  • (TypeError)


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

def limit(limit_value)
  raise TypeError, 'Limit should be as integer' unless limit_value.to_i.to_s == limit_value.to_s

  @limit = limit_value
  @loaded = false
  self
end