Class: Convergence::DatabaseConnector::MysqlConnector
- Inherits:
-
Object
- Object
- Convergence::DatabaseConnector::MysqlConnector
- Defined in:
- lib/convergence/database_connector/mysql_connector.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #client(database_name = @config.database) ⇒ Object
-
#initialize(config) ⇒ MysqlConnector
constructor
A new instance of MysqlConnector.
- #schema_client ⇒ Object
Constructor Details
#initialize(config) ⇒ MysqlConnector
Returns a new instance of MysqlConnector.
7 8 9 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 7 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 5 def config @config end |
Instance Method Details
#client(database_name = @config.database) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 11 def client(database_name = @config.database) @mysql ||= Mysql2::Client.new( { host: @config.host, port: @config.port, username: @config.username, password: @config.password, database: database_name }.merge!(@config.mysql.) ) end |
#schema_client ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 23 def schema_client @schema_mysql ||= Mysql2::Client.new( { host: @config.host, port: @config.port, username: @config.username, password: @config.password, database: 'information_schema' }.merge!(@config.mysql.) ) end |