Class: Omen::Query
- Inherits:
-
Object
- Object
- Omen::Query
- Defined in:
- app/models/omen/query.rb
Overview
The one SELECT Claude wrote, held by Postgres and by what it grants the role running it.
Constant Summary collapse
- UTC =
Rails writes every timestamp in UTC, which libpq would otherwise read as a local time.
{ oid: 1114, name: 'timestamp', format: 0 }
Instance Method Summary collapse
-
#answer ⇒ Hash
A savepoint, so a statement Postgres rejects leaves the surrounding transaction usable.
-
#initialize(sql) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(sql) ⇒ Query
Returns a new instance of Query.
7 8 9 |
# File 'app/models/omen/query.rb', line 7 def initialize(sql) @sql = sql end |
Instance Method Details
#answer ⇒ Hash
A savepoint, so a statement Postgres rejects leaves the surrounding transaction usable.
13 14 15 16 17 18 19 |
# File 'app/models/omen/query.rb', line 13 def answer record.connected_to role: Omen.config.reading_role do record.transaction requires_new: true do record.with_connection { |connection| run connection } end end end |