Documentation
¶
Index ¶
- func AssertIndexExists(t *testing.T, db *bun.DB, indexName string)
- func AssertRowCount(t *testing.T, db *bun.DB, tableName string, expected int)
- func AssertTableExists(t *testing.T, db *bun.DB, tableName string)
- func AssertTableNotExists(t *testing.T, db *bun.DB, tableName string)
- func ConnectDB(cfg *DatabaseConfig) (*bun.DB, error)
- func SetupTestDB(t *testing.T) (*bun.DB, func())
- type DatabaseConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertIndexExists ¶
AssertIndexExists checks if an index exists in the database
func AssertRowCount ¶
AssertRowCount checks if a table has the expected number of rows
func AssertTableExists ¶
AssertTableExists checks if a table exists in the database
func AssertTableNotExists ¶
AssertTableNotExists checks if a table does not exist in the database
Types ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
URL string `yaml:"url" validate:"required,url"`
SSLMode string `yaml:"ssl_mode" validate:"required,oneof=disable allow prefer require verify-ca verify-full"`
Timeout int `yaml:"timeout" default:"10"`
PoolSize int `yaml:"pool_size" default:"10"`
}
DatabaseConfig contains database connection settings
func (*DatabaseConfig) GetConnectionString ¶
func (c *DatabaseConfig) GetConnectionString() string
GetConnectionString returns a PostgreSQL connection string with sslmode applied when missing.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package migrations holds migrations related helpers
|
Package migrations holds migrations related helpers |
Click to show internal directories.
Click to hide internal directories.