bsql

package module
v0.0.0-...-69d8ed6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 9 Imported by: 0

README

bsql

sqlx wrapper with transaction implemented properly

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(db *sqlx.DB, log Logger) (Transactor, Factory)

Types

type Database

type Database interface {
	QueryRowxContext(ctx context.Context, query string, args ...interface{}) *sqlx.Row
	QueryxContext(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error)
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
}

type Factory

type Factory interface {
	FromContext(ctx context.Context) Database
}

type Logger

type Logger interface {
	Errorf(format string, args ...interface{})
}

type Transactor

type Transactor interface {
	Begin(ctx context.Context) (context.Context, error)
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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