database

package module
v0.0.0-...-98a3319 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

database

Database helper

Documentation

Index

Constants

View Source
const MaxAttempts = 1_000_000

Variables

View Source
var ErrMaxAttemptsExceeded = errors.New("max numbers of attempts exceeded")

Functions

func CreateBatchSize

func CreateBatchSize[T any](c *Connection) (size int, err error)

Types

type Config

type Config struct {
	Logger           *slog.Logger
	DSN              string      `yaml:"dsn"`
	ConnectionConfig gorm.Config `yaml:"-"`
}

type Connection

type Connection struct {
	Driver             DriverName
	TransactionCounter atomic.Int64
	Logger             *slog.Logger
	*gorm.DB
}

func SQLite

func SQLite(config Config) (conn *Connection, err error)

Easier local testing Database. Should not be used in production.

func (*Connection) Close

func (conn *Connection) Close() (err error)

func (*Connection) Transaction

func (c *Connection) Transaction(ctx context.Context, fc func(tx *gorm.DB) (err error), opts ...*sql.TxOptions) (err error)

type DriverName

type DriverName string
const DriverNameSQLite DriverName = "sqlite"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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