db

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UniqueViolation = "23505"
)

Variables

This section is empty.

Functions

func CheckForeignKeyViolation added in v1.0.1

func CheckForeignKeyViolation(err error) bool

func CheckNotUnique

func CheckNotUnique(err error) bool

Types

type OpenFunc added in v1.0.1

type OpenFunc func(driverName, dataSourceName string) (*sql.DB, error)

OpenFunc is a type for functions that open a database connection.

type Option

type Option func(*SQL)

Option -.

func ConnAttempts

func ConnAttempts(attempts int) Option

ConnAttempts -.

func ConnTimeout

func ConnTimeout(timeout time.Duration) Option

ConnTimeout -.

func EnableForeignKeys added in v1.0.1

func EnableForeignKeys(value bool) Option

EnableForeignKeys -.

func MaxPoolSize

func MaxPoolSize(size int) Option

MaxPoolSize -.

type SQL

type SQL struct {
	Builder    squirrel.StatementBuilderType
	Pool       *sql.DB
	IsEmbedded bool
	// contains filtered or unexported fields
}

SQL -.

func New

func New(url string, dbOpen OpenFunc, opts ...Option) (*SQL, error)

New -.

func (*SQL) Close

func (p *SQL) Close()

Close -.

Jump to

Keyboard shortcuts

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