Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunInitSQL ¶
RunInitSQL executes SQL statements from a local .sql file segment by segment (split by semicolon ;), idempotent scripts should use IF NOT EXISTS in SQL for protection
Types ¶
type Bootstrap ¶
type Bootstrap struct {
// contains filtered or unexported fields
}
Bootstrap represents the bootstrap service
func NewBootstrap ¶
NewBootstrap creates a new Bootstrap instance
func (*Bootstrap) PrintBannerFromFile ¶
PrintBannerFromFile Read file and print
type Options ¶
type Options struct {
// InitSQLPath points to a .sql script file (optional); skip if empty
InitSQLPath string
// AutoMigrate whether to execute entity migration (default true)
AutoMigrate bool
// SeedNonProd whether to write default configuration in non-production environments (default true)
SeedNonProd bool
// MigrationsDir path to migration SQL scripts directory
MigrationsDir string
// DBDriver database driver
DBDriver string
// DSN database connection string
DSN string
// Models list of models to migrate
Models []any
// SeedFuncs list of seed functions to execute after migration
SeedFuncs []SeedFunc
}
Options controls database initialization behavior
type SeedService ¶
type SeedService struct {
// contains filtered or unexported fields
}
SeedService handles database seeding operations
func NewSeedService ¶
func NewSeedService(db *gorm.DB) *SeedService
NewSeedService creates a new SeedService instance
func (*SeedService) SeedAll ¶
func (s *SeedService) SeedAll(seedFuncs ...SeedFunc) error
SeedAll executes all registered seed functions
Click to show internal directories.
Click to hide internal directories.