Documentation
¶
Overview ¶
Package db contains database interfaces and functions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSQLConnection ¶
func NewSQLConnection(p *ConnParams) (*sql.DB, error)
NewSQLConnection creates a new MySQL DB connection pool
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is an adapter for sql.DB so it follows the Conn interface
type Conn ¶
type Conn interface {
Begin() (Tx, error)
Exec(query string, args ...any) (sql.Result, error)
Query(query string, args ...any) (Rows, error)
QueryRow(query string, args ...any) Row
}
Conn generalizes an sql.Conn object
type ConnParams ¶
type ConnParams struct {
Type string
Host string
Port string
User string
Password string
Database string
}
ConnParams holds parameters for a MySQL DB connection
type MockAdapter ¶
MockAdapter is an adapter for tst.Conn so it follows the Conn interface
func NewMockAdapter ¶
func NewMockAdapter[T any](conn *tst.Conn[T]) *MockAdapter[T]
NewMockAdapter creates a new MockAdapter
func (*MockAdapter[T]) Begin ¶
func (a *MockAdapter[T]) Begin() (Tx, error)
Begin starts a transaction
type RowScanner ¶
RowScanner unifies the Row and Rows interface
Click to show internal directories.
Click to hide internal directories.