Documentation ¶
Overview ¶
Package clconnect provides generic fx dependency for standard ConnectRPC services.
Index ¶
- Variables
- func New[RO, RW any](cfg Config, logs *zap.Logger, ro RO, roc ConstructHandler[RO], rw RW, ...) http.Handler
- func Provide[RO, RW any](name string) fx.Option
- func ProvideEntTransactors[TX EntModelTx, MC EntModelClient[TX]]() fx.Option
- func ProvidePgxTransactors() fx.Option
- func TestProvide[RO, RW, ROC, ROW any](name string) fx.Option
- type Config
- type ConstructClient
- type ConstructHandler
- type EntModelClient
- type EntModelTx
- type EntROTransactor
- type EntRWTransactor
- type Logger
- type PgxROTransacter
- type PgxRWTransacter
- type ROTransacter
- type RWTransacter
- type Recoverer
Constants ¶
This section is empty.
Variables ¶
var ErrServerPanic = errors.New("server panic")
ErrServerPanic is returned when the server panicked.
Functions ¶
func New ¶
func New[RO, RW any]( cfg Config, logs *zap.Logger, ro RO, roc ConstructHandler[RO], rw RW, rwc ConstructHandler[RW], valr *validate.Interceptor, logr *Logger, rcvr *Recoverer, rotx ROTransacter, rwtx RWTransacter, ) http.Handler
New inits an http handler for the full RPC api.
func ProvideEntTransactors ¶ added in v0.19.1
func ProvideEntTransactors[TX EntModelTx, MC EntModelClient[TX]]() fx.Option
ProvideEntTransactors provides the RO transactor.
func ProvidePgxTransactors ¶ added in v0.19.1
ProvidePgxTransactors provides transactors for pgx transactions.
Types ¶
type Config ¶
type Config struct { // disables stack trace information in error details DisableStackTraceErrorDetails bool `env:"DISABLE_STACK_TRACE_ERROR_DETAILS"` }
Config configures the components.
type ConstructClient ¶
type ConstructClient[SC any] func(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SC
ConstructClient is a funct signature that constructs a client.
type ConstructHandler ¶
ConstructHandler defines the type for constructing a connectrpc service handler.
type EntModelClient ¶ added in v0.19.1
type EntModelClient[TX EntModelTx] interface { BeginTx(ctx context.Context, opts *entsql.TxOptions) (TX, error) }
EntModelClient is a generic type to constraint the model client to those generated by Ent.
type EntModelTx ¶ added in v0.19.1
EntModelTx is a generic type to constraint the tx to those generated by Ent.
type EntROTransactor ¶ added in v0.19.1
type EntROTransactor[TX EntModelTx, MC EntModelClient[TX]] struct { connect.Interceptor // contains filtered or unexported fields }
EntROTransactor provides an ent tx to the context.
func NewEntROTransactor ¶ added in v0.19.1
func NewEntROTransactor[TX EntModelTx, MC EntModelClient[TX]](logs *zap.Logger, mc MC) *EntROTransactor[TX, MC]
NewEntROTransactor its a RO transactor for the model client type.
type EntRWTransactor ¶ added in v0.19.1
type EntRWTransactor[TX EntModelTx, MC EntModelClient[TX]] struct { connect.Interceptor // contains filtered or unexported fields }
EntRWTransactor provides an ent tx to the context.
func NewEntRWTransactor ¶ added in v0.19.1
func NewEntRWTransactor[TX EntModelTx, MC EntModelClient[TX]](logs *zap.Logger, mc MC) *EntRWTransactor[TX, MC]
NewEntRWTransactor its a RW transactor for the model client type.
type Logger ¶ added in v0.18.1
type Logger struct { connect.Interceptor // contains filtered or unexported fields }
Logger logs RPC calls as an interceptor.
type PgxROTransacter ¶ added in v0.19.1
type PgxROTransacter struct { connect.Interceptor // contains filtered or unexported fields }
PgxROTransacter provides a database transaction in the context.
func NewPgxROTransacter ¶ added in v0.19.1
NewPgxROTransacter inits the Transacter.
type PgxRWTransacter ¶ added in v0.19.1
type PgxRWTransacter struct { connect.Interceptor // contains filtered or unexported fields }
PgxRWTransacter provides a database transaction in the context.
func NewPgxRWTransacter ¶ added in v0.19.1
NewPgxRWTransacter inits the Transacter.
type ROTransacter ¶ added in v0.18.2
type ROTransacter interface { connect.Interceptor // contains filtered or unexported methods }
ROTransacter is an interceptor that add read-only transactions to the context.
type RWTransacter ¶ added in v0.18.2
type RWTransacter interface { connect.Interceptor // contains filtered or unexported methods }
RWTransacter is an interceptor that add read-write transactions to the context.