sql

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

func Scan(dest interface{})

Types

type Executor

type Executor interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
}

type SQL

type SQL struct {
	Db *sql.DB
}

func NewSQL

func NewSQL(dataSource string, driver string) *SQL

func (*SQL) BeginTx

func (s *SQL) BeginTx() *Tx

type Transaction

type Transaction interface {
	Commit() error
	Rollback() error
}

type Tx

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

func NewTx

func NewTx(executor Executor, tx Transaction) *Tx

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Execute

func (tx *Tx) Execute(sql string, param ...interface{}) (int64, error)

func (*Tx) Query

func (tx *Tx) Query(dest interface{}, sql string, param ...interface{}) (int64, error)

func (*Tx) Rollback

func (tx *Tx) Rollback() error

type UnTx

type UnTx struct {
}

func (*UnTx) Commit

func (*UnTx) Commit() error

func (*UnTx) Rollback

func (*UnTx) Rollback() error

Jump to

Keyboard shortcuts

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