Documentation
¶
Index ¶
- func GetDemoCmd(ctx *appContext.Context) *cobra.Command
- func GetDemoRunFn(ctx *appContext.Context) func(*cobra.Command, []string) error
- func GetInitCmd(ctx *appContext.Context) *cobra.Command
- func GetInitRunFn(ctx *appContext.Context) func(*cobra.Command, []string) error
- func GetMigrateCmd(ctx *appContext.Context) *cobra.Command
- type CreateDemoDBFn
- type CreateInitDBFn
- type Migrator
- type MigratorFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDemoCmd ¶
func GetDemoCmd(ctx *appContext.Context) *cobra.Command
func GetDemoRunFn ¶
func GetInitCmd ¶
func GetInitCmd(ctx *appContext.Context) *cobra.Command
func GetInitRunFn ¶
func GetMigrateCmd ¶
func GetMigrateCmd(ctx *appContext.Context) *cobra.Command
Types ¶
type CreateDemoDBFn ¶
type CreateDemoDBFn func(ctx *appContext.Context) (*gorm.DB, error)
CreateDemoDBFn is a function type for creating database connection (used for testing)
var NewDemoDB CreateDemoDBFn = func(ctx *appContext.Context) (*gorm.DB, error) { return database.CreateDB(ctx) }
NewDemoDB is the function used to create database connection (can be replaced in tests)
type CreateInitDBFn ¶
type CreateInitDBFn func(ctx *appContext.Context) (*gorm.DB, error)
CreateInitDBFn is a function type for creating database connection (used for testing)
var NewInitDB CreateInitDBFn = func(ctx *appContext.Context) (*gorm.DB, error) { return database.CreateDB(ctx) }
NewInitDB is the function used to create database connection (can be replaced in tests)
type Migrator ¶
type Migrator interface {
Up() error
Down() error
Steps(n int) error
Version() (version uint, dirty bool, err error)
}
Migrator defines the interface for database migrations
type MigratorFactory ¶
type MigratorFactory func(ctx *appContext.Context) (Migrator, error)
MigratorFactory creates a Migrator instance
var NewMigrator MigratorFactory = createMigrator
NewMigrator is the factory function to create a Migrator (injectable for testing)
Click to show internal directories.
Click to hide internal directories.