Documentation ¶
Index ¶
- func ExecMigration(db *sql.DB)
- func InsertSeed(db *sql.DB)
- func ResetMigration(db *sql.DB)
- func SetupPostgres(ctx context.Context) *postgres.PostgresContainer
- type PostgresTestSuite
- func (s *PostgresTestSuite) CloseConnTemporary(t testing.TB)
- func (s *PostgresTestSuite) ExecQuery(t testing.TB, query string, args ...any) (pgx.Rows, error)
- func (s *PostgresTestSuite) InsertSeed(t testing.TB, dir string)
- func (s *PostgresTestSuite) ResetDB(t testing.TB)
- func (s *PostgresTestSuite) SwitchQuerier(t testing.TB, querier sqlc.Querier)
- func (s *PostgresTestSuite) TakeSnapshot(t testing.TB, snapshotName string)
- func (s *PostgresTestSuite) Terminate(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecMigration ¶
func SetupPostgres ¶
func SetupPostgres(ctx context.Context) *postgres.PostgresContainer
SetupPostgres starts a postgres container
Types ¶
type PostgresTestSuite ¶
type PostgresTestSuite struct { Container *postgres.PostgresContainer URL string Store *store.Store // contains filtered or unexported fields }
func SetupPostgresTestSuite ¶
func SetupPostgresTestSuite(ctx context.Context) *PostgresTestSuite
func (*PostgresTestSuite) CloseConnTemporary ¶
func (s *PostgresTestSuite) CloseConnTemporary(t testing.TB)
CloseConn closes the connection. After the test, the connection will be re-established.
func (*PostgresTestSuite) InsertSeed ¶
func (s *PostgresTestSuite) InsertSeed(t testing.TB, dir string)
InsertSeed inserts test seed data based on the seed path. Seed path is relative to the root directory.
func (*PostgresTestSuite) ResetDB ¶
func (s *PostgresTestSuite) ResetDB(t testing.TB)
ResetDB resets the database to the state of the snapshot without data
func (*PostgresTestSuite) SwitchQuerier ¶
func (s *PostgresTestSuite) SwitchQuerier(t testing.TB, querier sqlc.Querier)
func (*PostgresTestSuite) TakeSnapshot ¶
func (s *PostgresTestSuite) TakeSnapshot(t testing.TB, snapshotName string)
func (*PostgresTestSuite) Terminate ¶
func (s *PostgresTestSuite) Terminate(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.