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
5 6 7 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 5 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 3 def config @config end |
Instance Method Details
#client(database_name = @config.database) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 9 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 ) end |
#schema_client ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/convergence/database_connector/mysql_connector.rb', line 19 def schema_client @schema_mysql ||= Mysql2::Client.new( host: @config.host, port: @config.port, username: @config.username, password: @config.password, database: 'information_schema' ) end |