pg

package
v0.0.0-...-f15602e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pg utils for work with pg.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsForeignKeyViolationErr

func IsForeignKeyViolationErr(err error, fkName string) bool

IsForeignKeyViolationErr tells if given error is a postgres foreign key violation error "23503" of a given fk.

func IsUniqueViolationErr

func IsUniqueViolationErr(err error) bool

IsUniqueViolationErr tells if given error is a postgres unique violation error "23505".

Types

type TxManager

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

TxManager pg transaction manager implementation.

func NewTxManager

func NewTxManager(client *ent.Client, logger *zap.Logger) *TxManager

NewTxManager create instance of TxManager.

func (*TxManager) RunTransaction

func (p *TxManager) RunTransaction(
	ctx context.Context,
	options *sql.TxOptions,
	fn func(ctx context.Context) error,
) error

RunTransaction exec repository method in transaction.

Jump to

Keyboard shortcuts

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