mysql

package
v0.0.0-...-97a2a5b Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	Host         string
	Port         int
	Username     string
	Password     string
	DBname       string
	DBConnection *sql.DB
}

Connector to mysql DB

func NewConnection

func NewConnection(host string, port int, username, password, dbname string) *Connector

NewConnection is a constructor for mysql Connector

func (*Connector) Close

func (c *Connector) Close()

Close connection to MySQL

func (*Connector) Connect

func (c *Connector) Connect() error

Connect to MySQL

func (*Connector) Exec

func (c *Connector) Exec(query string, args ...interface{}) (sql.Result, error)

Exec query in MySQL

func (*Connector) Query

func (c *Connector) Query(query string, args ...interface{}) (*sql.Rows, error)

Query data from MySQL

type DBConnector

type DBConnector interface {
	Exec(string, ...interface{}) (sql.Result, error)
	Query(string, ...interface{}) (*sql.Rows, error)
	Close()
	Connect() error
}

Jump to

Keyboard shortcuts

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