runner

package
v0.0.0-...-4a0de68 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	DB *sqlx.DB
	*Queryable
}

Connection is a connection to the database with an EventReceiver

func NewConnection

func NewConnection(db *sql.DB, driverName string) *Connection

NewConnection instantiates a Connection for a given database/sql connection

func (*Connection) Begin

func (conn *Connection) Begin() (*Tx, error)

Begin creates a transaction for the given session

func (*Connection) Exec

func (conn *Connection) Exec(sql string, args ...interface{}) (sql.Result, error)

func (*Connection) ExecMulti

func (conn *Connection) ExecMulti(sql string) error

ExecMulti executes group SQL statemetns in a string marked by a marker. The deault marker is "GO"

func (*Connection) NewSession

func (cxn *Connection) NewSession() (*Session, error)

NewSession instantiates a Session for the Connection

type Execer

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

Execer implements dat.Execer

func NewExecer

func NewExecer(runner runner, builder dat.Builder) *Execer

NewExecer creates a new instance of Execer.

func (*Execer) Exec

func (ex *Execer) Exec() (*dat.Result, error)

Exec executes a builder's query.

func (*Execer) QueryScalar

func (ex *Execer) QueryScalar(destinations ...interface{}) error

QueryScalar executes builder's query and scans returned row into destinations.

func (*Execer) QuerySlice

func (ex *Execer) QuerySlice(dest interface{}) error

QuerySlice executes builder's query and builds a slice of values from each row, where each row only has one column.

func (*Execer) QueryStruct

func (ex *Execer) QueryStruct(dest interface{}) error

QueryStruct executes builders' query and scans the result row into dest.

func (*Execer) QueryStructs

func (ex *Execer) QueryStructs(dest interface{}) error

QueryStructs executes builders' query and scans each row as an item in a slice of structs.

func (*Execer) Queryx

func (ex *Execer) Queryx() (*sqlx.Rows, error)

Queryx executes builder's query and returns rows.

type M

type M map[string]string

M is generic string map.

type Queryable

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

Queryable is an object that can be queried.

func (*Queryable) DeleteFrom

func (q *Queryable) DeleteFrom(table string) *dat.DeleteBuilder

DeleteFrom creates a new DeleteBuilder for the given table.

func (*Queryable) ExecBuilder

func (q *Queryable) ExecBuilder(b dat.Builder) error

ExecBuilder executes the SQL in builder.

func (*Queryable) InsertInto

func (q *Queryable) InsertInto(table string) *dat.InsertBuilder

InsertInto creates a new InsertBuilder for the given table.

func (*Queryable) SQL

func (q *Queryable) SQL(sql string, args ...interface{}) *dat.RawBuilder

SQL creates a new raw SQL builder.

func (*Queryable) Select

func (q *Queryable) Select(columns ...string) *dat.SelectBuilder

Select creates a new SelectBuilder for the given columns.

func (*Queryable) Update

func (q *Queryable) Update(table string) *dat.UpdateBuilder

Update creates a new UpdateBuilder for the given table.

type Session

type Session struct {
	*Tx
}

Session represents a business unit of execution for some connection

func (*Session) Close

func (sess *Session) Close() error

Close closes the session.

type Tx

type Tx struct {
	sync.Mutex
	*sqlx.Tx
	*Queryable
	// contains filtered or unexported fields
}

Tx is a transaction for the given Session

func (*Tx) AutoCommit

func (tx *Tx) AutoCommit() error

AutoCommit commits a transaction IF neither Commit or Rollback were called.

func (*Tx) AutoRollback

func (tx *Tx) AutoRollback() error

AutoRollback rolls back transaction IF neither Commit or Rollback were called.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit finishes the transaction

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback cancels the transaction

func (*Tx) Select

func (tx *Tx) Select(columns ...string) *dat.SelectBuilder

Select creates a new SelectBuilder for the given columns. This disambiguates between Queryable.Select and sqlx's Select

Jump to

Keyboard shortcuts

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