bardo

package module
v0.0.0-...-64f8dc4 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDatabase

func CreateDatabase(url string) error

CreateDatabase ... Creates the database on the SQL server (if not exists)

func DropDatabase

func DropDatabase(url string) error

DropDatabase ...

func GetDBNameFromURL

func GetDBNameFromURL(url string) string

GetDBNameFromURL Get the database name from the open string

func ReplaceDBNameInURL

func ReplaceDBNameInURL(url string, dbname string) string

ReplaceDBNameInURL Replace the database name in the open string

Types

type Database

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

func Wrap

func Wrap(db *sqlx.DB) *Database

Wrap an existing sqlx DB

func (*Database) Begin

func (db *Database) Begin() error

func (*Database) Commit

func (db *Database) Commit() error

func (*Database) Exec

func (db *Database) Exec(
	query string,
	args ...interface{},
) (sql.Result, error)

func (*Database) Get

func (db *Database) Get(
	dest interface{}, query string, args ...interface{},
) error

func (*Database) Handle

func (db *Database) Handle() Handle

Handle returns the database/sql handle

func (*Database) InTransaction

func (db *Database) InTransaction() bool

func (*Database) Query

func (db *Database) Query(
	query string,
	args ...interface{},
) (*sql.Rows, error)

func (*Database) QueryRowx

func (db *Database) QueryRowx(
	query string,
	args ...interface{},
) *sqlx.Row

func (*Database) Queryx

func (db *Database) Queryx(
	query string,
	args ...interface{},
) (*sqlx.Rows, error)

func (*Database) Rollback

func (db *Database) Rollback() error

func (*Database) Select

func (db *Database) Select(
	dest interface{}, query string, args ...interface{},
) error

func (*Database) Truncate

func (db *Database) Truncate() error

Truncate ... Truncates all tables in the database TODO: Should accept exclusion list

func (*Database) UnWrap

func (db *Database) UnWrap() *sqlx.DB

UnWrap returns the jmoiron/sqlx handle

type Execer

type Execer interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
}

type Handle

type Handle interface {
	Execer
	Queryer
}

type Queryer

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

Jump to

Keyboard shortcuts

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