Skip to content

Instantly share code, notes, and snippets.

@eftalyurtseven
Created January 23, 2022 19:40
Show Gist options
  • Save eftalyurtseven/42a769ff3e7b2163576a5ccd8be4f86c to your computer and use it in GitHub Desktop.
Save eftalyurtseven/42a769ff3e7b2163576a5ccd8be4f86c to your computer and use it in GitHub Desktop.
package order
import (
"context"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
)
type FakePool struct {
dbpool *pgxpool.Pool
}
type FakePoolInterface interface {
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
}
func (p *FakePool) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error) {
return p.dbpool.BeginTx(ctx, txOptions)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment