mysql

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

gdbc-mysql

GDBC Mysql Driver - It is based on github.com/go-sql-driver/mysql

Go Report Card codecov Build Status

Usage

dataSource, err := gdbc.GetDataSource("gdbc:mysql://username:password@localhost:3000/testdb?charset=utf8mb4")
if err != nil {
    panic(err)
}

var connection *sql.DB
connection, err = dataSource.GetConnection()
if err != nil {
    panic(err)
}

Postgresql GDBC URL takes one of the following forms:

gdbc:mysql://host:port/database-name?arg1=value1
gdbc:mysql://host/database-name?arg1=value1
gdbc:mysql:database-name?arg1=value1
gdbc:mysql:?arg1=value1
gdbc:mysql://username:password@host:port/database-name?arg1=value1
gdbc:mysql:/database-name?socket=/tmp/mysql.sock&args1=value1

Using Socket:

You have to pass the argument socket, the argument does not belong to the driver.

gdbc:mysql:/database-name?socket=/tmp/mysql.sock&args1=value1

Default Values:

  • Host : localhost
  • Port : 3306
  • User : root
  • Password :

Checkout github.com/go-sql-driver/mysql for arguments details.

Documentation

Index

Constants

View Source
const DefaultHost = "localhost"
View Source
const DefaultPassword = ""
View Source
const DefaultPort = "3306"
View Source
const DefaultUsername = "root"

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLDataSourceNameAdapter

type MySQLDataSourceNameAdapter struct {
}

func (MySQLDataSourceNameAdapter) GetDataSourceName

func (dsnAdapter MySQLDataSourceNameAdapter) GetDataSourceName(dataSource gdbc.DataSource) (string, error)

Jump to

Keyboard shortcuts

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