seed

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 13 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"
)

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 PageTypeKey = "page"

PageTypeKey names the content type the demo pages belong to.

Variables

This section is empty.

Functions

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 Media added in v0.3.0

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

Media stores the scripted pictures the library does not already hold.

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 admin account does not already own.

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(name string, data []byte, authorID uuid.UUID) (media.Media, error)
	Remove(m media.Media) error
}

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

Jump to

Keyboard shortcuts

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