mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
17 lines
338 B
Crystal
17 lines
338 B
Crystal
|
module DB
|
||
|
def self.driver_class(name) # : Driver.class
|
||
|
@@drivers.not_nil![name]
|
||
|
end
|
||
|
|
||
|
def self.register_driver(name, klass : Driver.class)
|
||
|
@@drivers ||= {} of String => Driver.class
|
||
|
@@drivers.not_nil![name] = klass
|
||
|
end
|
||
|
|
||
|
def self.driver(name, options)
|
||
|
driver_class(name).new(options)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
require "./driver"
|