mysql

package
v3.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2023 License: MIT, Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

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

func (c *MySQLClient) Connect(host string, port int, username, password string) (bool, error)

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.

func (*MySQLClient) IsMySQL

func (c *MySQLClient) IsMySQL(host string, port int) (bool, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL