Help us shape the future of Go! Take the 2026 Go Developer Survey

seed

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package seed stores the demo data set a development database starts from.

Index

Constants

View Source
const (
	AdminEmail    = "admin@example.com"
	AdminName     = "Admin"
	AdminPassword = "password1234"
	EditorEmail   = "editor@example.com"
	EditorName    = "Editor"
	AuthorEmail   = "author@example.com"
	AuthorName    = "Author"
	MemberEmail   = "member@example.com"
	MemberName    = "Member"
)

Demo credentials stored by the seed subcommand, for development only.

View Source
const CategoriesFieldKey = "categories"

CategoriesFieldKey is the key posts point at their categories through.

View Source
const CategoryTypeKey = "category"

CategoryTypeKey is the key the demo categories are registered under.

View Source
const FeaturedFieldKey = "featured"

FeaturedFieldKey is the key the seeded switch the post list shows as a column stores its value under.

View Source
const FeaturesFieldKey = "features"

FeaturesFieldKey is the key the seeded flexible content field stores its rows under.

View Source
const OnSaleFieldKey = "on-sale"

OnSaleFieldKey is the key the seeded switch a rule reads stores its value under.

View Source
const PageTypeKey = "page"

PageTypeKey names the content type the demo pages belong to.

View Source
const PostsFiledFieldKey = "posts-filed-here"

PostsFiledFieldKey is the key the seeded category lists the posts filed under it through.

View Source
const SaleNoteFieldKey = "sale-note"

SaleNoteFieldKey is the key the seeded field shown by a rule stores its value under.

View Source
const TeamFieldKey = "team"

TeamFieldKey is the key the seeded repeater stores its rows under.

Variables

This section is empty.

Functions

func Backlinks(ctx context.Context, types *content.Registry) error

Backlinks declares the field listing the posts filed under a category.

func Categories added in v0.5.0

func Categories(
	ctx context.Context, store content.Store, types *content.Registry, users gouncer.Store,
) error

Categories registers the category type, its relation field, and the demo categories.

func CategoriesField added in v0.5.0

func CategoriesField() content.Field

CategoriesField returns the relation field the demo points posts at their categories through.

func CategoryType added in v0.5.0

func CategoryType() content.Type

CategoryType returns the content type the demo categories are registered under.

func Conditions added in v0.11.0

func Conditions(ctx context.Context, types *content.Registry) error

Conditions declares the seeded switch and the field its rule shows, the source first.

func Containers added in v0.11.0

func Containers(ctx context.Context, types *content.Registry) error

Containers declares the seeded repeater and the fields one of its rows holds.

func DemoStatuses added in v0.19.0

func DemoStatuses() map[content.Status]int

DemoStatuses returns how many of the demo posts Posts stores hold each status.

func FeatureLayouts added in v0.12.0

func FeatureLayouts() []content.Field

FeatureLayouts returns the layouts the seeded flexible offers, each carrying the fields it holds.

func Featured(ctx context.Context, types *content.Registry) error

Featured declares the switch the post list shows as a column, unless the post type already carries it.

func FeaturedField added in v0.19.0

func FeaturedField() content.Field

FeaturedField returns the switch the post list shows as a column and narrows by.

func FeaturesField added in v0.12.0

func FeaturesField() content.Field

FeaturesField returns the flexible content field the demo post type declares.

func Flexible added in v0.12.0

func Flexible(ctx context.Context, types *content.Registry) error

Flexible declares the demo flexible content field and the layouts it offers.

func Media added in v0.3.0

func Media(ctx context.Context, library MediaLibrary, store media.Store, users gouncer.Store) error

Media stores the scripted uploads the library does not already hold, each under its demo account.

func OnSaleField added in v0.11.0

func OnSaleField() content.Field

OnSaleField returns the switch the seeded rule reads.

func PageType added in v0.4.0

func PageType() content.Type

PageType returns the content type the demo pages are registered under.

func Pages added in v0.4.0

func Pages(ctx context.Context, store content.Store, types *content.Registry, users gouncer.Store) error

Pages stores the demo pages the site does not already hold.

func Posts

func Posts(ctx context.Context, store content.Store, types *content.Registry, users gouncer.Store) error

Posts stores the demo posts the site does not already hold, each credited to the demo account that wrote it.

func PostsFiledField added in v0.12.0

func PostsFiledField(sourceGroup string) content.Field

PostsFiledField returns the backlinks field the demo lists a category's posts through.

func SaleNoteField added in v0.11.0

func SaleNoteField() content.Field

SaleNoteField returns the field the seeding shows only while the switch is on.

func TeamField added in v0.11.0

func TeamField() content.Field

TeamField returns the repeater the seeding declares on the post type.

func TeamRowFields added in v0.11.0

func TeamRowFields() []content.Field

TeamRowFields returns the fields the seeding declares inside one row of the repeater.

func Types added in v0.4.0

func Types(ctx context.Context, types *content.Registry) error

Types registers the content types the demo data set needs beside the built-in one.

Types

type MediaLibrary added in v0.3.0

type MediaLibrary interface {
	Ingest(ctx context.Context, name string, data []byte, authorID uuid.UUID) (media.Media, error)
	Finish(m media.Media)
	Remove(m media.Media) error
}

MediaLibrary stores an upload's files, marks them finished and takes them back.

Jump to

Keyboard shortcuts

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