Documentation ¶
Index ¶
- func ExecInTransactionContext[T any](ctx context.Context, cf IConnectionFactory, tsf TransactionScopeFunction[T]) (T, error)
- func ExecStatement(connectionFactory IConnectionFactory, sql string, args ...any) chan async.ActionResult[EffectedRows]
- func ExecStatementTx(tx *sql.Tx, sql string, args ...any) chan async.ActionResult[EffectedRows]
- func QuerySingle[T any](connectionFactory IConnectionFactory, resultMapper ResultMapper[T], sql string, ...) chan async.ActionResult[T]
- func QuerySingleTx[T any](tx *sql.Tx, resultMapper ResultMapper[T], sql string, args ...any) chan async.ActionResult[T]
- func QueryStatement[T any](connectionFactory IConnectionFactory, resultMapper ResultMapper[T], sql string, ...) chan async.ActionResult[[]T]
- func QueryStatementTx[T any](tx *sql.Tx, resultMapper ResultMapper[T], sql string, args ...any) chan async.ActionResult[[]T]
- type ConnectionFactory
- type DbConnectionError
- type EffectedRows
- type IConnectionFactory
- type ResultMapper
- type TransactionScopeFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecInTransactionContext ¶ added in v0.0.7
func ExecInTransactionContext[T any](ctx context.Context, cf IConnectionFactory, tsf TransactionScopeFunction[T]) (T, error)
func ExecStatement ¶
func ExecStatement(connectionFactory IConnectionFactory, sql string, args ...any) chan async.ActionResult[EffectedRows]
func ExecStatementTx ¶
func ExecStatementTx(tx *sql.Tx, sql string, args ...any) chan async.ActionResult[EffectedRows]
func QuerySingle ¶
func QuerySingle[T any](connectionFactory IConnectionFactory, resultMapper ResultMapper[T], sql string, args ...any) chan async.ActionResult[T]
func QuerySingleTx ¶
func QuerySingleTx[T any](tx *sql.Tx, resultMapper ResultMapper[T], sql string, args ...any) chan async.ActionResult[T]
func QueryStatement ¶
func QueryStatement[T any](connectionFactory IConnectionFactory, resultMapper ResultMapper[T], sql string, args ...any) chan async.ActionResult[[]T]
func QueryStatementTx ¶
func QueryStatementTx[T any](tx *sql.Tx, resultMapper ResultMapper[T], sql string, args ...any) chan async.ActionResult[[]T]
Types ¶
type ConnectionFactory ¶
type ConnectionFactory struct {
// contains filtered or unexported fields
}
func (*ConnectionFactory) GetConnection ¶
GetConnection implements IConnectionFactory.
func (*ConnectionFactory) GetTransaction ¶
func (f *ConnectionFactory) GetTransaction(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
GetTransaction implements IConnectionFactory.
type DbConnectionError ¶
type DbConnectionError struct {
// contains filtered or unexported fields
}
func NewDbConnectionError ¶
func NewDbConnectionError(msg string, err error) *DbConnectionError
func (*DbConnectionError) Error ¶
func (e *DbConnectionError) Error() string
type EffectedRows ¶
type EffectedRows int
func EffectedRowsMapper ¶
func EffectedRowsMapper() ([]any, *EffectedRows)
type IConnectionFactory ¶
type IConnectionFactory interface { GetConnection(ctx context.Context) (*sql.Conn, error) GetTransaction(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) }
func NewConnectionFactory ¶
func NewConnectionFactory(connectionString, driver string) IConnectionFactory
type ResultMapper ¶
Click to show internal directories.
Click to hide internal directories.