xsql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core

type Core interface {
	Exec(ctx context.Context, query string, args ...interface{}) (rst sql.Result, err error)
	Query(ctx context.Context, query string, args ...interface{}) (rows *Rows, err error)
	QueryRow(ctx context.Context, query string, args ...interface{}) (row *Row, err error)
}

type DB

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

func New

func New(db *sql.DB) *DB

func (*DB) Exec

func (d *DB) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*DB) Query

func (d *DB) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*DB) QueryRow

func (d *DB) QueryRow(ctx context.Context, query string, args ...interface{}) (*Row, error)

func (*DB) Tx

func (d *DB) Tx(ctx context.Context, f func(context.Context) error) error

type DBItf

type DBItf interface {
	Core
	Tx(ctx context.Context, f func(context.Context) error) error
}

type Row

type Row struct {
	*sql.Row
}

func (*Row) Scan

func (r *Row) Scan(desc ...interface{}) error

type Rows

type Rows struct {
	*sql.Rows
}

func (*Rows) Scan

func (r *Rows) Scan(desc ...interface{}) error

type Tx

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

func (*Tx) Commit

func (t *Tx) Commit() error

func (*Tx) Exec

func (t *Tx) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*Tx) Query

func (t *Tx) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*Tx) QueryRow

func (t *Tx) QueryRow(ctx context.Context, query string, args ...interface{}) (*Row, error)

func (*Tx) Rollback

func (t *Tx) Rollback() error

func (*Tx) Tx

func (t *Tx) Tx(f func() error) (err error)

type TxItf

type TxItf interface {
	Core
	Rollback() error
	Commit() error
	Tx(f func() error) error
}

Jump to

Keyboard shortcuts

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