Documentation
¶
Index ¶
- Constants
- type PostgresQuerier
- func (q *PostgresQuerier) Close()
- func (q *PostgresQuerier) InsertGameResult(ctx context.Context, txn sqlx.Tx, gameResult entity.GameResult) (int, error)
- func (q *PostgresQuerier) SelectUser(ctx context.Context, userID int) (*entity.User, error)
- func (q *PostgresQuerier) TransactionIDExist(ctx context.Context, transactionID string) (bool, error)
- func (q *PostgresQuerier) UpdateUserBalance(ctx context.Context, txn sqlx.Tx, userID int, balance float64) error
- func (q *PostgresQuerier) WithTransaction(ctx context.Context, fn func(*sqlx.Tx) error) (err error)
- type Querier
Constants ¶
View Source
const ( CustomMigrationParam = "x-migrations-table" CustomMigrationValue = "schema_migrations" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresQuerier ¶
type PostgresQuerier struct {
// contains filtered or unexported fields
}
func NewPostgresQuerier ¶
func NewPostgresQuerier(ctx context.Context, url string) (*PostgresQuerier, error)
func (*PostgresQuerier) Close ¶
func (q *PostgresQuerier) Close()
func (*PostgresQuerier) InsertGameResult ¶
func (q *PostgresQuerier) InsertGameResult(ctx context.Context, txn sqlx.Tx, gameResult entity.GameResult) (int, error)
func (*PostgresQuerier) SelectUser ¶
func (*PostgresQuerier) TransactionIDExist ¶
func (*PostgresQuerier) UpdateUserBalance ¶
func (*PostgresQuerier) WithTransaction ¶
WithTransaction creates a new transaction and handles rollback/commit based on the error object returned by the `TxFn`
type Querier ¶
type Querier interface {
Close()
WithTransaction(ctx context.Context, fn func(*sqlx.Tx) error) (err error)
SelectUser(ctx context.Context, userID int) (*entity.User, error)
TransactionIDExist(ctx context.Context, transactionID string) (bool, error)
InsertGameResult(ctx context.Context, txn sqlx.Tx, gameResult entity.GameResult) (int, error)
UpdateUserBalance(ctx context.Context, txn sqlx.Tx, userID int, balance float64) error
}
Click to show internal directories.
Click to hide internal directories.