repositoryx

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: 3 Imported by: 0

Documentation

Overview

Package repositoryx is a set of util functions to be used in repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NopTxManager

type NopTxManager struct{}

NopTxManager transaction manager for tests.

func NewNopTxManager

func NewNopTxManager() *NopTxManager

NewNopTxManager create new NopTxManager.

func (NopTxManager) RunTransaction

func (NopTxManager) RunTransaction(ctx context.Context, _ *sql.TxOptions, fn func(context.Context) error) error

RunTransaction is no-op.

type Order

type Order uint8

Order present sql order ACS or DESC.

const (
	OrderAsc  Order = iota // ASC
	OrderDesc              // DESC
)

Allowed ordering.

func (Order) ToString

func (o Order) ToString(field string) string

ToString converts Order to string for given field name.

type TxManager

type TxManager interface {
	RunTransaction(ctx context.Context, options *sql.TxOptions, fn func(ctx context.Context) error) error
}

TxManager is repository transaction manager. If repository implementation not support transaction use NopTxManager.

Directories

Path Synopsis
Package pg utils for work with pg.
Package pg utils for work with pg.

Jump to

Keyboard shortcuts

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