Drop :nodoc: Database#initialize

This commit is contained in:
Brian J. Cardiff 2023-05-29 13:52:19 -03:00
parent 5515b78a53
commit cebb113901
2 changed files with 6 additions and 10 deletions

View file

@ -152,7 +152,12 @@ module DB
end
private def self.build_database(uri : URI)
Database.new(build_driver(uri), uri)
driver = build_driver(uri)
params = HTTP::Params.parse(uri.query || "")
connection_options = driver.connection_options(params)
pool_options = driver.pool_options(params)
factory = driver.connection_builder(uri)
Database.new(connection_options, pool_options, &factory)
end
private def self.build_connection(connection_string : String)

View file

@ -39,15 +39,6 @@ module DB
@setup_connection : Connection -> Nil
@statements_cache = StringKeyCache(PoolPreparedStatement).new
# :nodoc:
def initialize(driver : Driver, uri : URI)
params = HTTP::Params.parse(uri.query || "")
connection_options = driver.connection_options(params)
pool_options = driver.pool_options(params)
factory = driver.connection_builder(uri)
initialize(connection_options, pool_options, &factory)
end
# Initialize a database with the specified options and connection factory.
# This covers more advanced use cases that might not be supported by an URI connection string such as tunneling connection.
def initialize(connection_options : Connection::Options, pool_options : Pool::Options, &factory : -> Connection)