mysql

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	DB         *sql.DB
	RetryCount int
}

func Connect

func Connect(config mysqlconfig.Config) (*Entity, error)

Connect DB and return mysql entity

func (*Entity) Close

func (e *Entity) Close() error

func (*Entity) CommitTransaction

func (e *Entity) CommitTransaction(tx *sql.Tx) error

func (*Entity) Exec

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

func (*Entity) ExecuteQuery

func (e *Entity) ExecuteQuery(tx *sql.Tx, query string, args ...interface{}) (sql.Result, error)

func (*Entity) Insert

func (e *Entity) Insert(query string, args ...interface{}) (sql.Result, error)

func (*Entity) InsertMultiple

func (e *Entity) InsertMultiple(query string, bindVar string, noOfParams int, args ...interface{}) (sql.Result, error)

This function is used to insert multiple values in one query.

@params:

query: a query containing bindVar string
bindVar: its basically used to create a query, eg. `Insert INTO abc (column1, column2, column3) VALUES $$`. `$$` is the bindVar here
noOfParams: 3 in the above example. Its the number of columns to insert
args: list of arguments for the query.

func (*Entity) Query

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

func (*Entity) QueryRow

func (e *Entity) QueryRow(query string, args ...interface{}) *sql.Row

func (*Entity) RollbackTransaction

func (e *Entity) RollbackTransaction(tx *sql.Tx) error

func (*Entity) StartTransaction

func (e *Entity) StartTransaction() (*sql.Tx, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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