seed

package
v0.0.0-...-8495beb Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Account_000 = account.Account{ID: account.AccountID(id("00000000000000000010")), Name: "Francis J. Underwood", Email: "francis-j-underwood@car.ds", Admin: true}
	Account_001 = account.Account{ID: account.AccountID(id("00000000000000000020")), Name: "Claire Hale Underwood", Email: "claire-hale-underwood@car.ds", Admin: true}
	Account_002 = account.Account{ID: account.AccountID(id("00000000000000000030")), Name: "Zoe Barnes", Email: "zoe-barnes@car.ds"}
	Account_003 = account.Account{ID: account.AccountID(id("00000000000000000040")), Name: "Peter Russo", Email: "peter-russo@car.ds"}
	Account_004 = account.Account{ID: account.AccountID(id("00000000000000000050")), Name: "Doug Stamper", Email: "doug-stamper@car.ds"}
	Account_005 = account.Account{ID: account.AccountID(id("00000000000000000060")), Name: "Christina Gallagher", Email: "christina-gallagher@car.ds"}
	Account_006 = account.Account{ID: account.AccountID(id("00000000000000000070")), Name: "Linda Vasquez", Email: "linda-vasquez@car.ds"}
	Account_007 = account.Account{ID: account.AccountID(id("00000000000000000080")), Name: "Gillian Cole", Email: "gillian-cole@car.ds"}
	Account_008 = account.Account{ID: account.AccountID(id("00000000000000000090")), Name: "Janine Skorsky", Email: "janine-skorsky@car.ds"}
	Account_009 = account.Account{ID: account.AccountID(id("00000000000000000100")), Name: "Garrett Walker", Email: "garrett-walker@car.ds"}
	Account_010 = account.Account{ID: account.AccountID(id("00000000000000000110")), Name: "Lucas Goodwin", Email: "lucas-goodwin@car.ds"}
	Account_011 = account.Account{ID: account.AccountID(id("00000000000000000120")), Name: "Remy Danton", Email: "remy-danton@car.ds"}
	Account_012 = account.Account{ID: account.AccountID(id("00000000000000000130")), Name: "Tom Hammerschmidt", Email: "tom-hammerschmidt@car.ds"}
	Account_013 = account.Account{ID: account.AccountID(id("00000000000000000140")), Name: "Edward Meechum", Email: "edward-meechum@car.ds"}
	Account_014 = account.Account{ID: account.AccountID(id("00000000000000000150")), Name: "Rachel Posner", Email: "rachel-posner@car.ds"}
	Account_015 = account.Account{ID: account.AccountID(id("00000000000000000160")), Name: "Raymond Tusk", Email: "raymond-tusk@car.ds"}
	Account_016 = account.Account{ID: account.AccountID(id("00000000000000000170")), Name: "Cathy Durant", Email: "cathy-durant@car.ds"}
	Account_017 = account.Account{ID: account.AccountID(id("00000000000000000180")), Name: "Jackie Sharp", Email: "jackie-sharp@car.ds"}
	Account_018 = account.Account{ID: account.AccountID(id("00000000000000000190")), Name: "Gavin Orsay", Email: "gavin-orsay@car.ds"}
	Account_019 = account.Account{ID: account.AccountID(id("00000000000000000200")), Name: "Ayla Sayyad", Email: "ayla-sayyad@car.ds"}
	Account_020 = account.Account{ID: account.AccountID(id("00000000000000000210")), Name: "Seth Grayson", Email: "seth-grayson@car.ds"}
	Account_021 = account.Account{ID: account.AccountID(id("00000000000000000220")), Name: "Heather Dunbar", Email: "heather-dunbar@car.ds"}
	Account_022 = account.Account{ID: account.AccountID(id("00000000000000000230")), Name: "Thomas Yates", Email: "thomas-yates@car.ds"}
	Account_023 = account.Account{ID: account.AccountID(id("00000000000000000240")), Name: "Viktor Petrov", Email: "viktor-petrov@car.ds"}
	Account_024 = account.Account{ID: account.AccountID(id("00000000000000000250")), Name: "Kate Baldwin", Email: "kate-baldwin@car.ds"}
	Account_025 = account.Account{ID: account.AccountID(id("00000000000000000260")), Name: "LeAnn Harvey", Email: "le-ann-harvey@car.ds"}
	Account_026 = account.Account{ID: account.AccountID(id("00000000000000000270")), Name: "Will Conway", Email: "will-conway@car.ds"}
	Account_027 = account.Account{ID: account.AccountID(id("00000000000000000280")), Name: "Mark Usher", Email: "mark-usher@car.ds"}
	Account_028 = account.Account{ID: account.AccountID(id("00000000000000000290")), Name: "Jane Davis", Email: "jane-davis@car.ds"}
	Account_029 = account.Account{ID: account.AccountID(id("00000000000000000300")), Name: "Hannah Conway", Email: "hannah-conway@car.ds"}
	Account_030 = account.Account{ID: account.AccountID(id("00000000000000000310")), Name: "Aidan Macallan", Email: "aidan-macallan@car.ds"}
	Account_031 = account.Account{ID: account.AccountID(id("00000000000000000320")), Name: "Annette Shepherd", Email: "annette-shepherd@car.ds"}
	Account_032 = account.Account{ID: account.AccountID(id("00000000000000000330")), Name: "Bill Shepherd", Email: "bill-shepherd@car.ds"}
	Account_033 = account.Account{ID: account.AccountID(id("00000000000000000340")), Name: "Duncan Shepherd", Email: "duncan-shepherd@car.ds"}
)
View Source
var (
	Category_01_General = category.Category{
		ID:          category.CategoryID(id("00000000000000000010")),
		Name:        "General",
		Description: "General stuff",
		Colour:      "#ffffff",
		Sort:        0,
	}

	Category_02_Photos = category.Category{
		ID:          category.CategoryID(id("00000000000000000020")),
		Name:        "Media",
		Description: "Movies and tv shows",
		Colour:      "#ffffff",
		Sort:        1,
	}

	Category_03_Movies = category.Category{
		ID:          category.CategoryID(id("00000000000000000030")),
		Name:        "Movies",
		Description: "Movies discussion",
		Colour:      "#ffffff",
		Sort:        2,
	}

	Category_04_Music = category.Category{
		ID:          category.CategoryID(id("00000000000000000040")),
		Name:        "Music",
		Description: "Music discussion",
		Colour:      "#ffffff",
		Sort:        3,
	}

	Category_05_Admin = category.Category{
		ID:          category.CategoryID(id("00000000000000000050")),
		Name:        "Admin",
		Description: "Admin area",
		Colour:      "#ffffff",
		Sort:        4,
		Admin:       true,
	}
)
View Source
var (
	Post_01 = thread.Thread{
		ID:       post.PostID(id("00000000000000000010")),
		Title:    "Hello world!",
		Author:   thread.AuthorRef{ID: Account_000.ID},
		Category: Category_01_General,
		Posts: []*post.Post{
			{
				ID:         post.PostID(id("00000000000000001010")),
				Body:       "First reply",
				Short:      "First reply",
				RootPostID: post.PostID(id("00000000000000000010")),
				Author:     post.Author{ID: Account_003.ID},
			},
			{
				ID:         post.PostID(id("00000000000000002010")),
				Body:       "Second reply",
				Short:      "Second reply",
				RootPostID: post.PostID(id("00000000000000000010")),
				Author:     post.Author{ID: Account_004.ID},
			},
		},
	}
	Post_02 = thread.Thread{
		ID:       post.PostID(id("00000000000000000020")),
		Title:    "Hello, 世界",
		Author:   thread.AuthorRef{ID: Account_001.ID},
		Category: Category_01_General,
		Posts: []*post.Post{
			{
				ID:         post.PostID(id("00000000000000001020")),
				Body:       "First reply of other thread",
				Short:      "First reply of other thread",
				RootPostID: post.PostID(id("00000000000000000020")),
				Author:     post.Author{ID: Account_005.ID},
			},
			{
				ID:         post.PostID(id("00000000000000002020")),
				Body:       "Second reply of other thread",
				Short:      "Second reply of other thread",
				RootPostID: post.PostID(id("00000000000000000020")),
				Author:     post.Author{ID: Account_006.ID},
			},
		},
	}
)

Functions

func Create

func Create() fx.Option

Seed provides a type to the application which, when present in a component's dependency tree, will seed the database with all resource seed data.

Types

type Ready

type Ready struct{}

Ready is a type you can depend on during integration tests which, when used will ensure the database is seeded with data before your tests run. Usage is simple, use `bdd.Test` and add this value as a parameter to the test function invoke call:

bdd.Test(t, nil, fx.Invoke(

func(
    _ seed.Ready,
    repo user.Repository,
) {
    ... your test code

func New

func New(
	database *sql.DB,
	client *model.Client,
	account_repo account.Repository,
	category_repo category.Repository,
	thread_repo thread.Repository,
	post_repo post.Repository,
) (r Ready, err error)

New runs the data seeding script, creating all fake data for testing/demos.

Jump to

Keyboard shortcuts

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