stdpgxtxfx

package
v0.0.142 Latest Latest
Warning

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

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

Documentation

Overview

Package stdpgxtxfx provides database transactors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provide

func Provide(applicationName string) fx.Option

Provide provides the standard read-write/read-only separation.

func TestProvide

func TestProvide(applicationName, endRoleUsername, endRolePassword string) fx.Option

TestProvide provides project-specific transactor config to make it easy for any test package to interact with the database.

Types

type Config

type Config struct {
	TestMaxQueryCosts float64 `env:"TEST_MAX_QUERY_COSTS"`
}

Config configures the transact components.

type Params

type Params struct {
	fx.In
	Config
	RW *pgxpool.Pool `name:"rw"`
	RO *pgxpool.Pool `name:"ro"`
}

Params describe fx params for creating the transactors.

type Result

type Result struct {
	fx.Out
	ReadWrite *stdtx.Transactor[pgx.Tx] `name:"rw"`
	ReadOnly  *stdtx.Transactor[pgx.Tx] `name:"ro"`
}

Result describes the fx components this package produces.

func New

func New(params Params) (Result, error)

New provides the transactors.

Jump to

Keyboard shortcuts

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