Sha256: c3aa78a7a96a7a9076d5b60c3e46dfa266c651e95848fb2bca5f6aa46f2848f3

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

require_relative "helpers"

class ::Simple::SQL::Result < Array
end

require_relative "result/rows"
require_relative "result/records"

# The result of SQL.all
#
# This class implements the interface of a Result.
class ::Simple::SQL::Result < Array
  # A Result object is requested via ::Simple::SQL::Result.build, which then
  # chooses the correct implementation, based on the <tt>target_type:</tt>
  # parameter.
  def self.build(records, target_type:, pg_source_oid:) # :nodoc:
    if target_type.nil?
      Rows.new(records)
    else
      Records.new(records, target_type: target_type, pg_source_oid: pg_source_oid)
    end
  end

  attr_reader :total_count
  attr_reader :total_pages
  attr_reader :current_page
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple-sql-0.4.11 lib/simple/sql/result.rb
simple-sql-0.4.10 lib/simple/sql/result.rb