Documentation ¶
Index ¶
- func AnyTime() sqlmock.Argument
- func CreateGormDB(logger hclog.Logger, c *config.Config) (*gorm.DB, error)
- func Migrate(databaseURL string) error
- func MockQueueJob(mock sqlmock.Sqlmock, params interface{}, job string, priority int)
- func NewGormDB(databaseURL string) (*gorm.DB, error)
- func NewMockedGormDB() (*gorm.DB, sqlmock.Sqlmock)
- func NewTestPostgresDB(migrate bool) (*dockertest.Resource, string, error)
- func Ping(ctx context.Context, db *gorm.DB) error
- type NoOpCrypter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyTime ¶
func AnyTime() sqlmock.Argument
AnyTime will return an sqlmock.Argument which can match any time.Time argument.
func CreateGormDB ¶
CreateGormDB creates a configured gorm.DB
func Migrate ¶
Migrate leverages golang-migrate to perform a database migration using SQL migration files embedded within the binary.
func MockQueueJob ¶
func NewGormDB ¶
NewGormDB creates a gorm.DB given a database URL.
This is a utility function only to be used for tests.
func NewMockedGormDB ¶
NewMockedGormDB returns a mocked gorm.DB for use in tests.
func NewTestPostgresDB ¶
func NewTestPostgresDB(migrate bool) (*dockertest.Resource, string, error)
NewTestPostgresDB spawns a new Docker container running PostgreSQL v14.5 and executes database migration optionally.
Use "defer resource.Close()" to ensure the container is purged when you are done with it.
Types ¶
Click to show internal directories.
Click to hide internal directories.