Sha256: 95acb888b83ac11f95489978ee648787e9b367cfb87a6b061d255b8a4f3d646f
Contents?: true
Size: 797 Bytes
Versions: 1
Compression:
Stored size: 797 Bytes
Contents
# frozen_string_literal: true require 'simpleadmin/adapters/base' require 'simpleadmin/adapters/postgres' module Simpleadmin # Connector service that handles different databases to provide unified API endpoints # # @since 1.0.0 # class DatabaseConnector ADAPTERS_MAPPER = { postgres: Adapters::Postgres }.freeze def initialize(database_credentials:) @database_credentials = database_credentials end def client adapter.new(database_credentials: database_credentials) end private attr_reader :database_credentials def adapter adapter_class = ADAPTERS_MAPPER[database_credentials[:adapter]] raise ArgumentError, 'Invalid adapter name or adapter not exist' if adapter_class.nil? adapter_class end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simpleadmin-1.5.0 | lib/simpleadmin/database_connector.rb |