Class: Infrataster::Contexts::PgsqlQueryContext
- Inherits:
-
BaseContext
- Object
- BaseContext
- Infrataster::Contexts::PgsqlQueryContext
- Defined in:
- lib/infrataster/contexts/pgsql_query_context.rb
Instance Method Summary collapse
Instance Method Details
#connection ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/infrataster/contexts/pgsql_query_context.rb', line 24 def connection = {port: 5432, user: 'postgres', password: '', dbname: ''} if server.[:pgsql] = .merge(server.[:pgsql]) end server.forward_port([:port]) do |address, new_port| connect = PG::Connection.new( :host => address, :port => new_port, :user => [:user], :password => [:password], :dbname => [:dbname] ) end end |
#result ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/infrataster/contexts/pgsql_query_context.rb', line 7 def result = {port: 5432, user: 'postgres', password: '', dbname: ''} if server.[:pgsql] = .merge(server.[:pgsql]) end server.forward_port([:port]) do |address, new_port| connect = PG::Connection.new( :host => address, :port => new_port, :user => [:user], :password => [:password], :dbname => [:dbname] ) connect.exec(resource.query) end end |