Documentation
¶
Index ¶
- func List() []string
- func Register(seed ...Seeder)
- func Reset()
- func Run(ctx context.Context, db *dorm.DB, opts ...RunOption) error
- func Sync(ctx context.Context, db SessionProvider, value any, opts ...SyncOption) error
- type DependencyProvider
- type RunOption
- type Seeder
- type SessionProvider
- type SyncOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sync ¶
func Sync(ctx context.Context, db SessionProvider, value any, opts ...SyncOption) error
Sync reconciles one record or a collection of records against the database.
Types ¶
type DependencyProvider ¶
type DependencyProvider interface {
Dependencies() []string
}
DependencyProvider is optional for seeders that depend on other seeders.
type RunOption ¶
type RunOption func(*runConfig)
RunOption configures seeder execution.
func WithPerSeederTransaction ¶
func WithPerSeederTransaction() RunOption
WithPerSeederTransaction keeps the default per-seeder transaction mode explicit.
func WithSingleTransaction ¶
func WithSingleTransaction() RunOption
WithSingleTransaction wraps the full seed run in one transaction.
type Seeder ¶
Seeder defines a unit of seed work that can be executed by the runner.
func Registered ¶
func Registered() []Seeder
Registered returns the registered seeders in registration order.
type SessionProvider ¶
type SessionProvider interface {
WithContext(context.Context) *orm.Session
WithPolicy(access.Policy) *orm.Session
}
SessionProvider is the minimal database session surface required by Sync.
Click to show internal directories.
Click to hide internal directories.