Documentation ¶
Index ¶
- type MySQLClient
- func (c *MySQLClient) Connect(host string, port int, username, password string) (bool, error)
- func (c *MySQLClient) ConnectWithDB(host string, port int, username, password, dbName string) (bool, error)
- func (c *MySQLClient) ExecuteQuery(host string, port int, username, password, dbName, query string) (string, error)
- func (c *MySQLClient) IsMySQL(host string, port int) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLClient ¶
type MySQLClient struct{}
MySQLClient is a client for MySQL database.
Internally client uses go-sql-driver/mysql driver.
func (*MySQLClient) Connect ¶
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.
func (*MySQLClient) ConnectWithDB ¶
func (c *MySQLClient) ConnectWithDB(host string, port int, username, password, dbName string) (bool, error)
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.
func (*MySQLClient) ExecuteQuery ¶
func (c *MySQLClient) ExecuteQuery(host string, port int, username, password, dbName, query string) (string, error)
ExecuteQuery connects to Mysql database using given credentials and database name. and executes a query on the db.