Drop uri getter from database

This commit is contained in:
Brian J. Cardiff 2023-05-29 13:42:53 -03:00
parent 33a5b2b78b
commit 52f725c1c6

View file

@ -34,22 +34,19 @@ module DB
# :nodoc:
getter pool
# Returns the uri with the connection settings to the database
getter uri : URI
@connection_options : Connection::Options
@pool : Pool(Connection)
@setup_connection : Connection -> Nil
@statements_cache = StringKeyCache(PoolPreparedStatement).new
# :nodoc:
def initialize(driver : Driver, @uri : URI)
def initialize(driver : Driver, uri : URI)
params = HTTP::Params.parse(uri.query || "")
@connection_options = driver.connection_options(params)
pool_options = driver.pool_options(params)
@setup_connection = ->(conn : Connection) {}
factory = driver.connection_builder(@uri)
factory = driver.connection_builder(uri)
@pool = uninitialized Pool(Connection) # in order to use self in the factory proc
@pool = Pool.new(pool_options) {
conn = factory.call