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 ¶ added in v1.1.0
func ResetMigration ¶ added in v1.1.0
ResetMigration resets the database migration
func SetupPostgres ¶ added in v1.1.0
func SetupPostgres(ctx context.Context) *postgres.PostgresContainer
SetupPostgres starts a postgres container
Types ¶
type PostgresTestSuite ¶ added in v1.1.0
type PostgresTestSuite struct { Container *postgres.PostgresContainer URL string Store *store.Store // contains filtered or unexported fields }
func SetupPostgresTestSuite ¶ added in v1.1.0
func SetupPostgresTestSuite(ctx context.Context) *PostgresTestSuite
func (*PostgresTestSuite) CloseConnTemporary ¶ added in v1.1.0
func (s *PostgresTestSuite) CloseConnTemporary(t testing.TB)
CloseConn closes the connection. After the test, the connection will be re-established.
func (*PostgresTestSuite) InsertSeed ¶ added in v1.1.0
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 ¶ added in v1.1.0
func (s *PostgresTestSuite) ResetDB(t testing.TB)
ResetDB resets the database to the state of the snapshot without data
func (*PostgresTestSuite) SwitchQuerier ¶ added in v1.1.0
func (s *PostgresTestSuite) SwitchQuerier(t testing.TB, querier sqlc.Querier)
func (*PostgresTestSuite) TakeSnapshot ¶ added in v1.1.0
func (s *PostgresTestSuite) TakeSnapshot(t testing.TB, snapshotName string)
func (*PostgresTestSuite) Terminate ¶ added in v1.1.0
func (s *PostgresTestSuite) Terminate(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.