easy_db

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	ExecQuerier
}

Conn implements dialect.ExecQuerier given ExecQuerier.

func (Conn) Exec

func (c Conn) Exec(ctx context.Context, query string, args, v interface{}) error

Exec implements the dialect.Exec method.

func (Conn) Query

func (c Conn) Query(ctx context.Context, query string, args, v interface{}) error

Query implements the dialect.Query method.

type Driver

type Driver struct {
	Conn
	// contains filtered or unexported fields
}

Driver is a dialect.Driver implementation for SQL based databases.

func Open

func Open(driver, source string) (*Driver, error)

Open wraps the database/sql.Open method and returns a dialect.Driver.

func OpenDB

func OpenDB(driver string, db *sql.DB) *Driver

OpenDB wraps the given database/sql.DB method with a Driver.

func (*Driver) BeginTx

func (d *Driver) BeginTx(ctx context.Context, opts *TxOptions) (dialect.Tx, error)

BeginTx starts a transaction with options.

func (*Driver) Close

func (d *Driver) Close() error

Close closes the underlying connection.

func (Driver) DB

func (d Driver) DB() *sql.DB

DB returns the underlying *sql.DB instance.

func (Driver) Dialect

func (d Driver) Dialect() string

Dialect implements the dialect.Dialect method.

func (*Driver) Tx

func (d *Driver) Tx(ctx context.Context) (dialect.Tx, error)

Tx starts and returns a transaction.

type ExecQuerier

type ExecQuerier interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

ExecQuerier wraps the standard Exec and Query methods.

type NullBool

type NullBool = sql.NullBool

NullBool is an alias to sql.NullBool.

type NullFloat64

type NullFloat64 = sql.NullFloat64

NullFloat64 is an alias to sql.NullFloat64.

type NullInt64

type NullInt64 = sql.NullInt64

NullInt64 is an alias to sql.NullInt64.

type NullString

type NullString = sql.NullString

NullString is an alias to sql.NullString.

type NullTime

type NullTime = sql.NullTime

NullTime represents a time.Time that may be null.

type Result

type Result = sql.Result

Result is an alias to sql.Result.

type Rows

type Rows struct{ *sql.Rows }

Rows wraps the sql.Rows to avoid locks copy.

type Tx

type Tx struct {
	dialect.ExecQuerier
	driver.Tx
}

Tx implements dialect.Tx interface.

type TxOptions

type TxOptions = sql.TxOptions

TxOptions holds the transaction options to be used in DB.BeginTx.

Jump to

Keyboard shortcuts

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