mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Start moving out URI from ConnectionContext
Create connections with an initial context. Database will set itself as context after connection has been created
This commit is contained in:
parent
da7494b5ba
commit
3828e17a40
6 changed files with 15 additions and 19 deletions
|
@ -48,7 +48,7 @@ class FooDriver < DB::Driver
|
|||
end
|
||||
|
||||
def build_connection(context : DB::ConnectionContext) : DB::Connection
|
||||
FooConnection.new(context)
|
||||
FooConnection.new
|
||||
end
|
||||
|
||||
class FooConnection < DB::Connection
|
||||
|
@ -111,7 +111,7 @@ class BarDriver < DB::Driver
|
|||
end
|
||||
|
||||
def build_connection(context : DB::ConnectionContext) : DB::Connection
|
||||
BarConnection.new(context)
|
||||
BarConnection.new
|
||||
end
|
||||
|
||||
class BarConnection < DB::Connection
|
||||
|
|
|
@ -3,12 +3,11 @@ require "../src/db"
|
|||
|
||||
class DummyDriver < DB::Driver
|
||||
def build_connection(context : DB::ConnectionContext) : DB::Connection
|
||||
DummyConnection.new(context)
|
||||
DummyConnection.new
|
||||
end
|
||||
|
||||
class DummyConnection < DB::Connection
|
||||
def initialize(context)
|
||||
super(context)
|
||||
def initialize
|
||||
@connected = true
|
||||
@@connections ||= [] of DummyConnection
|
||||
@@connections.not_nil! << self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue