sqldbutils

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sqldbutils provides database utilities for transaction management and common database operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoInTransaction

func DoInTransaction(ctx context.Context, db *sqlx.DB, fn func(tx *sqlx.Tx) error) error

DoInTransaction executes a function within a database transaction with automatic commit/rollback handling.

Types

type DBTx

type DBTx interface {
	Get(dest interface{}, query string, args ...any) error
	GetContext(ctx context.Context, dest any, query string, args ...any) error
	Select(dest any, query string, args ...any) error
	SelectContext(ctx context.Context, dest any, query string, args ...any) error

	Exec(query string, args ...any) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

DBTx defines the interface for database transaction operations.

Jump to

Keyboard shortcuts

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