sqlchelpers

package
v0.55.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeadlockRetry = func(l *zerolog.Logger, f func() error) error {
	return genericRetry(l.Warn(), 3, f, "deadlock", func(err error) (bool, error) {
		return strings.Contains(err.Error(), "deadlock detected"), err
	}, 50*time.Millisecond, 200*time.Millisecond)
}

Functions

func BoolFromBoolean

func BoolFromBoolean(v bool) pgtype.Bool

func DeferRollback

func DeferRollback(ctx context.Context, l *zerolog.Logger, rollback func(context.Context) error)

func DurationToPgInterval

func DurationToPgInterval(d time.Duration) pgtype.Interval

func PrepareTx

func PrepareTx(ctx context.Context, pool *pgxpool.Pool, l *zerolog.Logger, timeoutMs int) (pgx.Tx, func(context.Context) error, func(), error)

func TextFromStr

func TextFromStr(str string) pgtype.Text

func TimestampFromTime

func TimestampFromTime(t time.Time) pgtype.Timestamp

func TimestamptzFromTime

func TimestamptzFromTime(t time.Time) pgtype.Timestamptz

func ToInt

func ToInt(i int32) pgtype.Int4

func UUIDFromStr

func UUIDFromStr(uuid string) pgtype.UUID

func UUIDToStr

func UUIDToStr(uuid pgtype.UUID) string

func UniqueSet

func UniqueSet(uuids []pgtype.UUID) []pgtype.UUID

Types

This section is empty.

Jump to

Keyboard shortcuts

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