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

starter

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package starter installs the optional starter content of the setup wizard: a home page with sections, About and Contact pages, two blog posts, header and footer menus and a contact form. Install is idempotent by slug (a re-run fills what is missing and touches nothing else) but not one transaction: the content services each own their connections, so an interrupted run is finished by running it again.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entities

type Entities interface {
	GetSchemaBySlug(ctx context.Context, slug string) (*entity.EntitySchema, error)
	GetEntityBySlug(ctx context.Context, slug string) (*entity.Entity, error)
	CreateEntity(ctx context.Context, userID *uuid.UUID, in *entity.CreateEntityInput) (*entity.Entity, error)
	UpdateEntity(ctx context.Context, id uuid.UUID, userID *uuid.UUID, in *entity.UpdateEntityInput) (*entity.Entity, error)
	UpdateEntityStatus(ctx context.Context, id uuid.UUID, userID *uuid.UUID, status entity.EntityStatus) (*entity.Entity, error)
}

Entities is the slice of entity.Service the installer uses.

type Forms

type Forms interface {
	GetFormBySlug(ctx context.Context, slug string) (*form.Form, error)
	CreateForm(ctx context.Context, in *form.CreateFormInput) (*form.Form, error)
}

Forms is the slice of form.Service the installer uses.

type Installer

type Installer struct {
	Entities   Entities
	Menus      Menus
	Forms      Forms
	Site       Site
	Invalidate func(context.Context)
}

Installer holds the services. Invalidate clears the rendered-page cache.

func (*Installer) Install

func (in *Installer) Install(ctx context.Context, o Options) (Result, error)

Install creates the starter content.

type Menus interface {
	GetMenuByLocation(ctx context.Context, location string) (*menu.Menu, error)
	GetMenuWithItems(ctx context.Context, menuID uuid.UUID) (*menu.Menu, error)
	CreateMenu(ctx context.Context, in *menu.CreateMenuInput) (*menu.Menu, error)
	CreateMenuItem(ctx context.Context, menuID uuid.UUID, in *menu.CreateMenuItemInput) (*menu.MenuItem, error)
}

Menus is the slice of menu.Service the installer uses.

type Options

type Options struct {
	SiteName string
	// NotifyEmail receives contact form submissions ("" = none).
	NotifyEmail string
	// UserID is recorded as the author of the created content.
	UserID *uuid.UUID
}

Options personalise the content.

type Result

type Result struct {
	Pages, Posts, Menus, MenuItems, Forms int
}

Result counts what this run created (a second run reports zeros).

func (Result) Total

func (r Result) Total() int

Total is everything created.

type Site

type Site interface {
	Update(ctx context.Context, in siteconfig.UpdateInput) (*siteconfig.Config, error)
}

Site is the slice of siteconfig.Store the installer uses.

Jump to

Keyboard shortcuts

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