db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConfig

type DBConfig struct {
	DSN           string
	EnableWALMode bool
}

DBConfig defines the options for PersistentSQLx

func WithOptions

func WithOptions(defaultOpts func() *DBConfig, opts ...OptFunc[DBConfig]) *DBConfig

WithOptions builds the options with the given opt

type OptFunc

type OptFunc[T any] func(*T)

OptFunc defines the signature for an option function

func WithDSN

func WithDSN(dsn string) OptFunc[DBConfig]

WithDSN sets the DSN

func WithEnableWALMode

func WithEnableWALMode(enable bool) OptFunc[DBConfig]

WithEnableWALMode sets the WAL mode

type PersistentSQLx

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

PersistentSQLx contains the persistent database connection

func MustConnect

func MustConnect(opts ...OptFunc[DBConfig]) *PersistentSQLx

Connect creates a new PersistentSQLx instance

func NewWithOptions

func NewWithOptions(opts *DBConfig) *PersistentSQLx

NewWithOptions creates a new PersistentSQLx instance with the given options

func (*PersistentSQLx) GetDB

func (psqlx *PersistentSQLx) GetDB() *sqlx.DB

GetDB returns the database connection

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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