xsql

package
v0.9.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDriverUnsupported = errors.New("(xsql) driver not supported")

Functions

func DeferCloseRows

func DeferCloseRows(rows *sql.Rows)

DeferCloseRows closes rows. This is used with the `defer` statement. The error is conveniently ignored.

func DeferRollback

func DeferRollback(tx *sql.Tx)

DeferRollback rolls back tx. This is used with the `defer` statement. The error is conveniently ignored.

func SetDataSourceNameDatabase

func SetDataSourceNameDatabase(driverName, dsn, dbName string) (string, error)

Types

type ColumnInfo

type ColumnInfo struct {
	TableName        string
	Name             string
	DataType         string
	Nullable         bool
	CharMaxLength    *int
	CharOctetLength  *int
	PartOfPrimaryKey bool
}

type DB

type DB struct {
	*sql.DB
	DataSourceName string
	Driver         string
}

DB is a wrapper around xsql.DB offering a pool of connections.

func Open

func Open(driverName, dataSourceName string) (*DB, error)

Open opens a database specified by its database driver name and a driver-specific data source name. Arguments are checked, and the database is pinged.

Panics when driver is not supported.

func (*DB) ColumnInfo

func (db *DB) ColumnInfo(table, column string) (*ColumnInfo, error)

func (*DB) HaveConstraint

func (db *DB) HaveConstraint(table string, constraint string) (bool, error)

HaveConstraint checks whether constraint is available for table.

func (*DB) HaveIndex

func (db *DB) HaveIndex(table string, index string) (bool, error)

HaveConstraint checks whether constraint is available for table.

func (*DB) HaveTable

func (db *DB) HaveTable(table string) (bool, error)

HaveTable checks whether table is available.

func (*DB) HaveTrigger

func (db *DB) HaveTrigger(table string, trigger string) (bool, error)

HaveTrigger checks whether trigger is available for table.

Jump to

Keyboard shortcuts

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