Documentation
¶
Overview ¶
Package stdenttxfx provides database transactors.
Index ¶
- func Provide[T stdent.Tx, C stdent.Client[T]](applicationName string, clientFactory ClientFactoryFunc[T, C]) fx.Option
- func TestProvide[T stdent.Tx, C stdent.Client[T]](applicationName, endRoleUsername, endRolePassword string, ...) fx.Option
- type ClientFactoryFunc
- type Config
- type Params
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Provide ¶
func Provide[T stdent.Tx, C stdent.Client[T]](applicationName string, clientFactory ClientFactoryFunc[T, C]) fx.Option
Provide provides the standard read-write/read-only separation.
func TestProvide ¶
func TestProvide[T stdent.Tx, C stdent.Client[T]]( applicationName, endRoleUsername, endRolePassword string, clientFactory ClientFactoryFunc[T, C], ) fx.Option
TestProvide provides project-specific transactor config to make it easy for any test package to interact with the database.
Types ¶
type ClientFactoryFunc ¶
type Config ¶
type Config struct {
TestMaxQueryCosts float64 `env:"TEST_MAX_QUERY_COSTS"`
}
Config configures the transact components.
type Params ¶
type Params[T stdent.Tx, C stdent.Client[T]] struct { fx.In fx.Lifecycle Config RW *sql.DB `name:"rw"` RO *sql.DB `name:"ro"` ClientFactory ClientFactoryFunc[T, C] TxBeginSQL stdent.BeginHookFunc `optional:"true"` }
Params describe fx params for creating the transactors.
type Result ¶
type Result[T stdent.Tx] struct { fx.Out ReadWrite *stdent.Transactor[T] `name:"rw"` ReadOnly *stdent.Transactor[T] `name:"ro"` }
Result describes the fx components this package produces.
Click to show internal directories.
Click to hide internal directories.