mysql
(mysql).MySQLClient
MySQLClient is a client for MySQL database. Internally client uses go-sql-driver/mysql driver. Kind: inner class ofmysql
mySQLClient.Connect(host, port, username, password) ⇒ bool
Connect connects to MySQL database using given credentials. If connection is successful, it returns true. If connection is unsuccessful, it returns false and error. The connection is closed after the function returns.
Kind: instance method of MySQLClientReturns:
bool - - The result of the connection attempt.Throws:
error- The error encountered during connection attempt.
Example
mySQLClient.ConnectWithDB(host, port, username, password, dbName) ⇒ bool
ConnectWithDB connects to MySQL database using given credentials and database name. If connection is successful, it returns true. If connection is unsuccessful, it returns false and error. The connection is closed after the function returns.
Kind: instance method of MySQLClientReturns:
bool - - The result of the connection attempt.Throws:
error- The error encountered during connection attempt.
Example
mySQLClient.ExecuteQuery(host, port, username, password, dbName, query) ⇒ string
ExecuteQuery connects to Mysql database using given credentials and database name and executes a query on the db.
Kind: instance method of MySQLClientReturns:
string - - The result of the query execution.Throws:
error- The error encountered during query execution.
Example
mySQLClient.IsMySQL(host, port) ⇒ bool
IsMySQL checks if the given host is running MySQL database. If the host is running MySQL database, it returns true. If the host is not running MySQL database, it returns false.
Kind: instance method of MySQLClientReturns:
bool - - The result of the check.Throws:
error- The error encountered during the check.
Example