seed

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 2 Imported by: 47

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	TenantId string
	//extra properties
	Extra map[string]interface{}
}

func NewSeedContext

func NewSeedContext(tenantId string, extra map[string]interface{}) *Context

func (*Context) WithExtra

func (s *Context) WithExtra(k string, v interface{}) *Context

type Contrib

type Contrib interface {
	Seed(ctx context.Context, sCtx *Context) error
}

func Chain

func Chain(seeds ...Contrib) Contrib

type DefaultSeeder

type DefaultSeeder struct {
	// contains filtered or unexported fields
}

func NewDefaultSeeder

func NewDefaultSeeder(contrib ...Contrib) *DefaultSeeder

func (*DefaultSeeder) Seed

func (d *DefaultSeeder) Seed(ctx context.Context, options ...Option) error

type Option

type Option func(opt *SeedOption)

func AddHost

func AddHost() Option

func AddTenant

func AddTenant(tenants ...string) Option

func SetExtra

func SetExtra(key string, v interface{}) Option

func WithExtra

func WithExtra(extra map[string]interface{}) Option

func WithTenantId

func WithTenantId(tenants ...string) Option

type SeedOption

type SeedOption struct {
	TenantIds []string
	Extra     map[string]interface{}
}

func NewOption

func NewOption() *SeedOption

type Seeder

type Seeder interface {
	Seed(ctx context.Context, option ...Option) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL