postgres

package
v0.0.0-...-dd0d759 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIsolationLevel = errors.New("invalid isolation level")
View Source
var IsolationLevels = map[string]sql.IsolationLevel{
	"Default":         sql.LevelDefault,
	"ReadUncommitted": sql.LevelReadUncommitted,
	"ReadCommitted":   sql.LevelReadCommitted,
	"WriteCommitted":  sql.LevelWriteCommitted,
	"RepeatableRead":  sql.LevelRepeatableRead,
	"Snapshot":        sql.LevelSnapshot,
	"Serializable":    sql.LevelSerializable,
	"Linearizable":    sql.LevelLinearizable,
}

Functions

func HandleError

func HandleError(err error) error

func IsSQLNoRowsError

func IsSQLNoRowsError(err error) bool

func IsViolatedForeignKeyError

func IsViolatedForeignKeyError(err error) bool

Types

type DB

type DB struct {
	*sqlx.DB
	// contains filtered or unexported fields
}

func NewDB

func NewDB(connString, isolationLevel string) (*DB, error)

func NewMockDB

func NewMockDB() (*DB, sqlmock.Sqlmock, error)

func (*DB) Begintx

func (db *DB) Begintx(ctx context.Context) (*sqlx.Tx, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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