database

package
v0.0.0-...-18aef32 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block func(db *sqlx.Tx, c chan error)

Block contains a transaction block

type MySQL

type MySQL struct {
	Config *config.Config
	DB     *sqlx.DB
}

MySQL is the MySQL database class

func (*MySQL) Get

func (m *MySQL) Get(dest interface{}, query string, args ...interface{}) (err error)

Get gets data

func (*MySQL) In

func (m *MySQL) In(query string, params ...interface{}) (string, []interface{}, error)

In performs queries with IN clause

func (*MySQL) IsReady

func (m *MySQL) IsReady() bool

IsReady checks that the database is ready for operation

func (*MySQL) NamedIn

func (m *MySQL) NamedIn(query string, params map[string]interface{}) (string, []interface{}, error)

NamedIn performs queries with IN clause using named query

func (*MySQL) Prepare

func (m *MySQL) Prepare(query string) (*sqlx.NamedStmt, error)

Prepare prepares an SQL statement

func (*MySQL) PrepareBind

func (m *MySQL) PrepareBind(query string) (*sqlx.Stmt, error)

PrepareBind prepares and binds an SQL statement

func (*MySQL) Rebind

func (m *MySQL) Rebind(query string) string

Rebind rebinds an SQL statement

func (*MySQL) Select

func (m *MySQL) Select(dest interface{}, query string, args ...interface{}) (err error)

Select selects records

func (*MySQL) Shutdown

func (m *MySQL) Shutdown()

Shutdown cleans up everything and shuts down

func (*MySQL) Startup

func (m *MySQL) Startup()

Startup perform startup functions

func (*MySQL) WithTransaction

func (m *MySQL) WithTransaction(db *MySQL, block Block) (err error)

WithTransaction performs queries with transaction

Jump to

Keyboard shortcuts

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