sqlchelpers

package
v0.51.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 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 added in v0.34.1

func BoolFromBoolean(v bool) pgtype.Bool

func DeferRollback added in v0.50.0

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

func DurationToPgInterval added in v0.50.0

func DurationToPgInterval(d time.Duration) pgtype.Interval

func PrepareTx added in v0.50.0

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 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 added in v0.50.0

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