gdo

package module
v0.0.0-...-135b31f Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotConvert = errors.New("gdo: cannot convert value to type")
View Source
var ErrColNotFound = errors.New("gdo: column not found")
View Source
var ErrParameterMismatch = errors.New("gdo: you have a parameter mismatch")

Functions

This section is empty.

Types

type ExecResult

type ExecResult struct {
	GDOResult
	sql.Result
}

type GDO

type GDO struct {
	*sql.DB
}

func New

func New(db *sql.DB) *GDO

func (GDO) BeginTx

func (g GDO) BeginTx() (Transaction, error)

func (GDO) BeginTxContext

func (g GDO) BeginTxContext(ctx context.Context, opts *sql.TxOptions) (Transaction, error)

func (GDO) Exec

func (g GDO) Exec(s *Statement) (ExecResult, error)

func (GDO) ExecContext

func (g GDO) ExecContext(ctx context.Context, s *Statement) (ExecResult, error)

func (GDO) Prepare

func (g GDO) Prepare(query string) (*PreparedStatement, error)

func (GDO) PrepareContext

func (g GDO) PrepareContext(ctx context.Context, query string) (*PreparedStatement, error)

func (GDO) Query

func (g GDO) Query(s *Statement) (QueryResult, error)

func (GDO) QueryContext

func (g GDO) QueryContext(ctx context.Context, s *Statement) (QueryResult, error)

func (GDO) QueryRow

func (g GDO) QueryRow(s *Statement) QueryRowResult

func (GDO) QueryRowContext

func (g GDO) QueryRowContext(ctx context.Context, s *Statement) QueryRowResult

type GDOResult

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

func (GDOResult) LastExecutedQuery

func (r GDOResult) LastExecutedQuery() string

type PreparedStatement

type PreparedStatement struct {
	*Statement
	*sql.Stmt
	// contains filtered or unexported fields
}

func (*PreparedStatement) Exec

func (ps *PreparedStatement) Exec() (ExecResult, error)

func (*PreparedStatement) ExecContext

func (ps *PreparedStatement) ExecContext(ctx context.Context) (ExecResult, error)

func (*PreparedStatement) Query

func (ps *PreparedStatement) Query() (QueryResult, error)

func (*PreparedStatement) QueryContext

func (ps *PreparedStatement) QueryContext(ctx context.Context) (QueryResult, error)

func (*PreparedStatement) QueryRow

func (ps *PreparedStatement) QueryRow() QueryRowResult

func (*PreparedStatement) QueryRowContext

func (ps *PreparedStatement) QueryRowContext(ctx context.Context) QueryRowResult

type QueryResult

type QueryResult struct {
	GDOResult
	Rows *sql.Rows
	Cols []string
}

func (QueryResult) FetchRows

func (r QueryResult) FetchRows() Rows

func (QueryResult) FetchRowsTyped

func (qr QueryResult) FetchRowsTyped(t interface{}) (interface{}, error)

type QueryRowResult

type QueryRowResult struct {
	QueryResult
	// contains filtered or unexported fields
}

func (QueryRowResult) FetchRow

func (qrr QueryRowResult) FetchRow() Row

func (QueryRowResult) LastError

func (qrr QueryRowResult) LastError() error

type Row

type Row map[string]interface{}

func (Row) Bool

func (r Row) Bool(col string) (bool, error)

func (Row) Bytes

func (r Row) Bytes(col string) ([]byte, error)

func (Row) Float32

func (r Row) Float32(col string) (float32, error)

func (Row) Float64

func (r Row) Float64(col string) (float64, error)

func (Row) Int

func (r Row) Int(col string) (int, error)

func (Row) String

func (r Row) String(col string) (string, error)

func (Row) Time

func (r Row) Time(col string) (time.Time, error)

type Rows

type Rows []Row

type Statement

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

func NewStatement

func NewStatement(query string) *Statement

NewStatement returns a Statement

func (*Statement) BindArg

func (stmt *Statement) BindArg(arg interface{})

func (*Statement) BindArgs

func (stmt *Statement) BindArgs(args []interface{})

func (*Statement) BindNamedArg

func (stmt *Statement) BindNamedArg(namedArg sql.NamedArg)

func (*Statement) BindNamedArgs

func (stmt *Statement) BindNamedArgs(namedArgs []sql.NamedArg)

type Transaction

type Transaction struct {
	*sql.Tx
}

func (Transaction) Exec

func (tx Transaction) Exec(s *Statement) (ExecResult, error)

func (Transaction) ExecContext

func (tx Transaction) ExecContext(ctx context.Context, s *Statement) (ExecResult, error)

func (Transaction) Query

func (tx Transaction) Query(s *Statement) (QueryResult, error)

func (Transaction) QueryContext

func (tx Transaction) QueryContext(ctx context.Context, s *Statement) (QueryResult, error)

func (Transaction) QueryRow

func (tx Transaction) QueryRow(s *Statement) QueryRowResult

func (Transaction) QueryRowContext

func (tx Transaction) QueryRowContext(ctx context.Context, s *Statement) QueryRowResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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