db

package
v0.0.0-...-26c5fb3 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDB = errors.Validation.NewWithKeyAndDetail("ERR_NO_DB", "no db")
)

Functions

This section is empty.

Types

type DB

type DB interface {
	DB() (*sql.DB, error)
	GormDB() *gorm.DB
}

DB is a local interface that lets us narrow down a database type for testing.

func New

func New(gormdb *gorm.DB) DB

func OpenDBConnection

func OpenDBConnection(opts DBConnectionOpts) (DB, error)

type DBConnectionOpts

type DBConnectionOpts struct {
	Name            string
	Password        string
	Host            string
	Database        string
	MaxIdleConns    uint64
	MaxOpenConns    uint64
	MaxConnLifetime uint64
	OpenFunc        func(dsn string) (DB, error)
}

type Database

type Database struct {
	// contains filtered or unexported fields
}

func (*Database) DB

func (db *Database) DB() (*sql.DB, error)

func (*Database) GormDB

func (db *Database) GormDB() *gorm.DB

Jump to

Keyboard shortcuts

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