mysql

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 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 MySQL

type MySQL struct {
	// contains filtered or unexported fields
}

func NewMySQL

func NewMySQL() *MySQL

func (*MySQL) BeginTx

func (m *MySQL) BeginTx() (*Tx, error)

func (*MySQL) Close

func (m *MySQL) Close() error

func (*MySQL) Delete

func (m *MySQL) Delete(query string, args ...any) (int64, error)

func (*MySQL) GetConn

func (m *MySQL) GetConn() *sql.DB

func (*MySQL) Insert

func (m *MySQL) Insert(query string, args ...any) (int64, error)

func (*MySQL) InsertContext

func (m *MySQL) InsertContext(ctx context.Context, query string, args ...any) (int64, error)

func (*MySQL) Open

func (m *MySQL) Open(dsn string, ops ...Option) error

func (*MySQL) Ping

func (m *MySQL) Ping(ctx context.Context) error

func (*MySQL) QueryForMap

func (m *MySQL) QueryForMap(query string, args ...any) (map[string]any, error)

func (*MySQL) QueryForMapSlice

func (m *MySQL) QueryForMapSlice(query string, args ...any) ([]map[string]any, error)

func (*MySQL) QueryMapContext

func (m *MySQL) QueryMapContext(ctx context.Context, query string, args ...any) (map[string]any, error)

func (*MySQL) QueryMapSliceContext

func (m *MySQL) QueryMapSliceContext(ctx context.Context, query string, args ...any) ([]map[string]any, error)

func (*MySQL) Update

func (m *MySQL) Update(query string, args ...any) (int64, error)

func (*MySQL) UpdateContext

func (m *MySQL) UpdateContext(ctx context.Context, query string, args ...any) (int64, error)

type Option

type Option func(*MySQL)

func WithMaxConns

func WithMaxConns(count int) Option

func WithMaxIdle

func WithMaxIdle(count int) Option

func WithMaxLifetime

func WithMaxLifetime(ex time.Duration) Option

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

func (*Tx) Close

func (t *Tx) Close() error

func (*Tx) Delete

func (t *Tx) Delete(query string, args ...any) (int64, error)

func (*Tx) DeleteContext

func (t *Tx) DeleteContext(ctx context.Context, query string, args ...any) (int64, error)

func (*Tx) HasError

func (t *Tx) HasError()

func (*Tx) Insert

func (t *Tx) Insert(query string, args ...any) (int64, error)

func (*Tx) InsertContext

func (t *Tx) InsertContext(ctx context.Context, query string, args ...any) (int64, error)

func (*Tx) QueryForMap

func (t *Tx) QueryForMap(query string, args ...any) (map[string]any, error)

func (*Tx) QueryForMapSlice

func (t *Tx) QueryForMapSlice(query string, args ...any) ([]map[string]any, error)

func (*Tx) QueryMapContext

func (t *Tx) QueryMapContext(ctx context.Context, query string, args ...any) (map[string]any, error)

func (*Tx) QueryMapSliceContext

func (t *Tx) QueryMapSliceContext(ctx context.Context, query string, args ...any) ([]map[string]any, error)

func (*Tx) Update

func (t *Tx) Update(query string, args ...any) (int64, error)

func (*Tx) UpdateContext

func (t *Tx) UpdateContext(ctx context.Context, query string, args ...any) (int64, error)

Jump to

Keyboard shortcuts

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