database

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDSN added in v0.3.1

func CheckDSN(driver, dsn, dbName, dbHost, dbPort, dbUser, dbPass string) string

func CheckDriver added in v0.3.1

func CheckDriver(driver string) string

checks

func Connect

func Connect(driver, dsn string) (interface{}, error)

func DefaultPorts added in v0.3.1

func DefaultPorts() map[string]string

func PGXConnect added in v0.3.1

func PGXConnect(dsn string) (*pgx.Conn, error)

func PGXExec added in v0.3.1

func PGXExec(db *pgx.Conn, ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

func PGXExecNoResult added in v0.3.1

func PGXExecNoResult(db *pgx.Conn, ctx context.Context, query string, args ...interface{}) error

func PGXQuery added in v0.3.1

func PGXQuery(db *pgx.Conn, ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)

func PGXQueryRow added in v0.3.1

func PGXQueryRow(db *pgx.Conn, ctx context.Context, query string, args ...interface{}) pgx.Row

func SQLConnect added in v0.3.1

func SQLConnect(driver, dsn string) (*sql.DB, error)

Connect to database

func SQLExec added in v0.3.1

func SQLExec(db *sql.DB, ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func SQLExecNoResult added in v0.3.1

func SQLExecNoResult(db *sql.DB, ctx context.Context, query string, args ...interface{}) error

func SQLQuery added in v0.3.1

func SQLQuery(db *sql.DB, ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func SQLQueryRow added in v0.3.1

func SQLQueryRow(db *sql.DB, ctx context.Context, query string, args ...interface{}) *sql.Row

func SetDBDriver added in v0.3.1

func SetDBDriver(driver string, usePgx bool) string

func SupportedDrivers added in v0.3.1

func SupportedDrivers() []string

Types

type DB added in v0.3.1

type DB struct {
	Driver string
	UsePgx bool
	// contains filtered or unexported fields
}

func New added in v0.3.1

func New() DB

All databases will use the sql.DB interface unless pgx is specified pgx is a PostgreSQL driver that is more efficient than the standard sql.DB pgx will be used if the driver is set to "pgx" or "postgres" and pgxNew is called

func (*DB) CheckDriver added in v0.3.1

func (d *DB) CheckDriver()

func (*DB) Close added in v0.3.1

func (d *DB) Close() error

func (*DB) Exec added in v0.3.1

func (d *DB) Exec(ctx context.Context, query string, args ...interface{}) (interface{}, error)

func (*DB) ExecNoResult added in v0.3.1

func (d *DB) ExecNoResult(ctx context.Context, query string, args ...interface{}) error

func (*DB) Open added in v0.3.1

func (d *DB) Open(dsn string) error

func (*DB) PGXNew added in v0.3.1

func (d *DB) PGXNew(db *pgx.Conn)

func (*DB) Pgx added in v0.3.1

func (d *DB) Pgx() *pgx.Conn

func (*DB) PgxClose added in v0.3.1

func (d *DB) PgxClose() error

func (*DB) PgxExec added in v0.3.1

func (d *DB) PgxExec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

func (*DB) PgxExecNoResult added in v0.3.1

func (d *DB) PgxExecNoResult(ctx context.Context, query string, args ...interface{}) error

func (*DB) PgxOpen added in v0.3.1

func (d *DB) PgxOpen(dsn string) error

func (*DB) PgxQuery added in v0.3.1

func (d *DB) PgxQuery(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)

func (*DB) PgxQueryRow added in v0.3.1

func (d *DB) PgxQueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row

func (*DB) Query added in v0.3.1

func (d *DB) Query(ctx context.Context, query string, args ...interface{}) (interface{}, error)

func (*DB) QueryRow added in v0.3.1

func (d *DB) QueryRow(ctx context.Context, query string, args ...interface{}) interface{}

func (*DB) SetDB added in v0.3.1

func (d *DB) SetDB(db interface{}, driver string)

func (*DB) SetDSN added in v0.3.1

func (d *DB) SetDSN(driver, dsn, dbName, dbHost, dbPort, dbUser, dbPass string) string

func (*DB) SetDriver added in v0.3.1

func (d *DB) SetDriver(driver string, usePgx bool)

func (*DB) Sql added in v0.3.1

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

func (*DB) SqlClose added in v0.3.1

func (d *DB) SqlClose() error

func (*DB) SqlExec added in v0.3.1

func (d *DB) SqlExec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*DB) SqlExecNoResult added in v0.3.1

func (d *DB) SqlExecNoResult(ctx context.Context, query string, args ...interface{}) error

func (*DB) SqlNew added in v0.3.1

func (d *DB) SqlNew(db *sql.DB, driver string)

func (*DB) SqlOpen added in v0.3.1

func (d *DB) SqlOpen(driver, dsn string) error

func (*DB) SqlQuery added in v0.3.1

func (d *DB) SqlQuery(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func (*DB) SqlQueryRow added in v0.3.1

func (d *DB) SqlQueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row

Jump to

Keyboard shortcuts

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