seeds

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithUserCreatedAt

func WithUserCreatedAt(createdAt time.Time) userSeedOption

func WithUserEmail

func WithUserEmail(email string) userSeedOption

func WithUserEmailVerifiedAt

func WithUserEmailVerifiedAt(emailVerifiedAt time.Time) userSeedOption

func WithUserID

func WithUserID(id uuid.UUID) userSeedOption

func WithUserIsAdmin

func WithUserIsAdmin(isAdmin bool) userSeedOption

func WithUserUpdatedAt

func WithUserUpdatedAt(updatedAt time.Time) userSeedOption

Types

type Seed

type Seed interface {
	Generate(ctx context.Context, dbtx db.DBTX) error
}

type SeedBuilder

type SeedBuilder[T, V any] interface {
	WithRandoms(n int) *T
	WithSpecific(data map[string]any) *T
	Build() *V
}

type Seeder

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

func NewSeeder

func NewSeeder() Seeder

func (Seeder) PlantUser

func (s Seeder) PlantUser(
	ctx context.Context,
	opts ...userSeedOption,
) (models.UserEntity, error)

func (Seeder) PlantUsers

func (s Seeder) PlantUsers(
	ctx context.Context,
	amount int,
) ([]models.UserEntity, error)

Jump to

Keyboard shortcuts

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