Documentation
¶
Index ¶
- Variables
- func NewSQliteClient(cfg *Config) (*sql.DB, error)
- func PaginateSelection(query sq.SelectBuilder, cmd *PaginateCmd) sq.SelectBuilder
- type Client
- func (c *Client) Exec(query string, args ...any) (sql.Result, error)
- func (c *Client) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (c *Client) Query(query string, args ...any) (*sql.Rows, error)
- func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (c *Client) QueryRow(query string, args ...any) *sql.Row
- func (c *Client) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- type Config
- type PaginateCmd
- type Querier
- type Result
- type RowScanner
- type SQLTime
- type TransacService
- type Transactor
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNonMatchingOrderAndStart = errors.New("OrderBy and StartAfter doesn't have the same number of arguments")
Functions ¶
func PaginateSelection ¶
func PaginateSelection(query sq.SelectBuilder, cmd *PaginateCmd) sq.SelectBuilder
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ExecContext ¶
func (*Client) QueryContext ¶
type PaginateCmd ¶
type Querier ¶
type Querier interface {
Exec(query string, args ...any) (sql.Result, error)
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
Query(query string, args ...any) (*sql.Rows, error)
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
QueryRow(query string, args ...any) *sql.Row
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}
func NewSQLQuerier ¶
func NewTestStorage ¶
type RowScanner ¶
type RowScanner interface {
Scan(...interface{}) error
}
RowScanner is the interface that wraps the Scan method.
Scan behaves like database/sql.Row.Scan.
type TransacService ¶
type TransacService struct {
// contains filtered or unexported fields
}
func NewTransacGenerator ¶
func NewTransacGenerator(db *sql.DB, tools tools.Tools) *TransacService
func (*TransacService) WithinTransaction ¶
func (t *TransacService) WithinTransaction(ctx context.Context, tFunc func(ctx context.Context) error) error
WithinTransaction runs function within transaction
The transaction commits when function were finished without error
type Transactor ¶
type Transactor interface {
// WithinTransaction runs a function within a database transaction.
//
// Transaction is propagated in the context,
// so it is important to propagate it to underlying repositories.
// Function commits if error is nil, and rollbacks if not.
// It returns the same error.
WithinTransaction(context.Context, func(ctx context.Context) error) error
}
Transactor runs logic inside a single database transaction
Click to show internal directories.
Click to hide internal directories.