class Rotor::Adapters::PG < Rotor::Adapter

PostgreSQL, through pg: over a pool (each statement takes a connection; a transaction keeps one) or one connection.

/home/runner/work/rotor/rotor/src/adapter.qz:91

Class methods

def self.new(*, pool: PG::Pool) -> Rotor::Adapters::PG

Over a pool.

/home/runner/work/rotor/rotor/src/adapter.qz:96

def self.new(*, connection: PG::Connection) -> Rotor::Adapters::PG

Over one connection.

/home/runner/work/rotor/rotor/src/adapter.qz:102

Methods

def query(sql: String, params: Array[Object?]) -> Rotor::Rows

Runs sql with params ($1...): its rows, or what it changed.

from Rotor::Adapter

/home/runner/work/rotor/rotor/src/adapter.qz:107

def in_transaction? -> Bool

Whether a transaction is open on the connection this adapter holds (false when it holds none, over a pool).

from Rotor::Adapter

/home/runner/work/rotor/rotor/src/adapter.qz:116

def pooled? -> Bool

Whether the adapter takes its connections from a pool, so that one hold gives back is its to reset.

from Rotor::Adapter

/home/runner/work/rotor/rotor/src/adapter.qz:121

def hold(&: (Rotor::Adapter) -> Object?) -> Object?

Runs the block with an adapter whose statements all go through one connection (a session's state, an advisory lock, stays theirs): this one when it has a single connection.

from Rotor::Adapter

/home/runner/work/rotor/rotor/src/adapter.qz:123

def transaction(&: (Rotor::Adapter) -> Object?) -> Object?

Runs the block in a transaction, given an adapter bound to it: committed when the block returns, rolled back when it raises.

from Rotor::Adapter

/home/runner/work/rotor/rotor/src/adapter.qz:131