go-db-shell

module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MPL-2.0

README

go-db-shell

Go Reference Go version Go MySQL Driver version

https://github.com/go-sql-driver/mysql/tree/v1.6.0

An extra layer which make communicate with database safer. All the query with placeholders will be escaped.

Example

Below is the example of how to create the db connection

db, err := mysql.Open(mysql.Config{
    Host:         "127.0.0.1",
    Port:         3306,
    Username:     "username",
    Password:     "password",
    DatabaseName: "database",
})

if err != nil {
    panic(err)
}

defer db.Close()

How to execute SQL query and get results are the same as what you would do with go-mysql-driver.

Avaiable functoins
  • query()
  • queryRow()
  • execute()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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