Class: Swift::Adapter::Postgres

Inherits:
Sql show all
Defined in:
lib/swift/adapter/postgres.rb

Direct Known Subclasses

Eventmachine::Postgres, Synchrony::Postgres

Constant Summary

Constants inherited from Swift::Adapter

EM

Instance Attribute Summary

Attributes inherited from Swift::Adapter

#db

Instance Method Summary collapse

Methods inherited from Sql

#fields, #transaction

Methods included from Migrations::InstanceMethods

#migrate!

Methods inherited from Swift::Adapter

#create, #delete, #execute, #get, #identity_map, #log_command, #prepare, #trace, #trace?, #update

Constructor Details

#initialize(options = {}) ⇒ Postgres

Returns a new instance of Postgres


7
8
9
# File 'lib/swift/adapter/postgres.rb', line 7

def initialize options = {}
  super Swift::DB::Postgres.new(options)
end

Instance Method Details

#field_type(attribute) ⇒ Object


15
16
17
18
19
20
# File 'lib/swift/adapter/postgres.rb', line 15

def field_type attribute
  case attribute
    when Type::IO then 'bytea'
    else super
  end
end

#returning?Boolean

Returns:

  • (Boolean)

11
12
13
# File 'lib/swift/adapter/postgres.rb', line 11

def returning?
  true
end

#tablesObject


22
23
24
# File 'lib/swift/adapter/postgres.rb', line 22

def tables
  execute('select tablename from pg_tables where schemaname = current_schema').map(&:values).flatten
end