sqlcommons

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DBNotSupported   = errors.New("DataBase not supported")
	DBNotInitialized = errors.New("DataBase not initialized")
	ConnectionFailed = errors.New("Connection Failed")
	ConnectionClosed = errors.New("Connection Closed")
	NextValueFailed  = errors.New("Unable to get next sequence value")
	OpNotSupported   = errors.New("Operation not supported")
	TxNotFoundInCtx  = errors.New("SQLTx not found in context")

	UniqueConstraintViolation     = errors.New("Unique constraint violation")
	IntegrityConstraintViolation  = errors.New("Integrity constraint violation")
	ValueTooLargeForColumn        = errors.New("Value too large for column")
	ValueLargerThanPrecision      = errors.New("Value larger than specified precision")
	CannotSetNullColumn           = errors.New("Cannot set a NULL value into a NOT NULL column")
	InvalidNumericValue           = errors.New("Invalid number")
	SubqueryReturnsMoreThanOneRow = errors.New("Subquery returns more than one row")
)

Errors

Functions

This section is empty.

Types

type MockSQLConnector

type MockSQLConnector interface {
	SQLConnector

	PatchBegin(err error)
	PatchCommit(err error)
	PatchRollback(err error)

	PatchExec(query string, err error, args ...driver.Value)
	PatchQuery(query string, columns []string, values []driver.Value, err error, args ...driver.Value)
	PatchQueryRow(query string, result map[string]string, err error)
}

type SQLAdapter

type SQLAdapter interface {
	Translate(query string) string
	ErrorHandler(err error) error
}

type SQLConnector

type SQLConnector interface {
	Open(logger logger.Logger, translator SQLAdapter) (*sql.DB, error)
	GetNextSequenceQuery(sequenceName string) string
}

Jump to

Keyboard shortcuts

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