db

package
v0.0.0-...-534bf45 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListLimit = 50
	MaximumListLimit = 100

	ErNoReferencedRow     = 1215
	ErDupEntry            = 1062
	ErDupEntryWithKeyName = 1586
)

Variables

View Source
var DB = func() *sql.DB {
	db, err := sql.Open("mysql", env.CoreDBDSN)
	if err != nil {
		panic(fmt.Errorf("error opening database: %w", err))
	}

	return db
}()

Functions

func ExtractDBErrorCode

func ExtractDBErrorCode(err error) uint16

func PingDB

func PingDB(db *sql.DB) error

Types

type Queryable

type Queryable interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Prepare(query string) (*sql.Stmt, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
}

Jump to

Keyboard shortcuts

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