db

package
v0.0.0-...-fc9f681 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadAffectedCount = errors.New("bad affected count")

Functions

func Begin

func Begin() (*sql.Tx, error)

func BeginTx

func BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)

func CheckAffected

func CheckAffected(rslt sql.Result, sqlErr error, expected ...int) error

CheckAffected checks if result.RowsAffected() are equal to the expected

func Close

func Close() error

func Conn

func Conn(ctx context.Context) (*sql.Conn, error)

func Driver

func Driver() driver.Driver

func Exec

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

func ExecContext

func ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func Init

func Init(driverName, dataSourceName string) (err error)

func IsMySQLDuplicate

func IsMySQLDuplicate(err error) bool

IsMySQLDuplicate checks if mysql error is ER_DUP_ENTRY mysql error

func Ping

func Ping() error

func PingContext

func PingContext(ctx context.Context) error

func Prepare

func Prepare(query string) (*sql.Stmt, error)

func PrepareContext

func PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)

func Query

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

func QueryContext

func QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func QueryRow

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

func QueryRowContext

func QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

func SetConnMaxLifetime

func SetConnMaxLifetime(d time.Duration)

func SetMaxIdleConns

func SetMaxIdleConns(n int)

func SetMaxOpenConns

func SetMaxOpenConns(n int)

func Stats

func Stats() sql.DBStats

Types

type MapBool

type MapBool map[string]bool

func (*MapBool) Scan

func (p *MapBool) Scan(src interface{}) error

func (MapBool) Value

func (p MapBool) Value() (driver.Value, error)

type MapString

type MapString map[string]string

func (*MapString) Scan

func (p *MapString) Scan(src interface{}) error

func (MapString) Value

func (p MapString) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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