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

builder

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RevisionKindSave    = "save"
	RevisionKindPublish = "publish"
	RevisionKindRestore = "restore"
	RevisionKindReset   = "reset"
)

Variables

View Source
var ErrConflict = errors.New("builder: document changed; reload before saving")
View Source
var ErrForbidden = content.ErrForbidden
View Source
var ErrNotFound = content.ErrNotFound
View Source
var ErrProfile = errors.New("builder: invalid site profile")

Functions

func ProvisionStudio

func ProvisionStudio(ctx context.Context, d *kernel.Deps, in ProvisionInput) error

ProvisionStudio resumes its own interrupted import, never adopts an existing site.

func Render

func Render(doc Document) (string, error)

func Validate

func Validate(doc Document) error

func ValidatePublication

func ValidatePublication(doc Document) error

ValidatePublication allows incomplete drafts but requires a visible page heading for publishing.

Types

type BlockSpec

type BlockSpec struct {
	Kind  string `json:"kind"`
	Label string `json:"label"`
}

func Catalog

func Catalog(locale string) []BlockSpec

type Document

type Document struct {
	Version  int       `json:"version"`
	Sections []Section `json:"sections"`
}

type Draft

type Draft struct {
	ContentToken   string   `json:"content_token"`
	HasPublished   bool     `json:"has_published"`
	ContentChanged bool     `json:"content_changed"`
	Document       Document `json:"document"`
	BaseUpdatedAt  string   `json:"base_updated_at" format:"-"`
	UpdatedAt      string   `json:"updated_at" format:"-"`
}

type Entry

type Entry struct {
	Title    string `json:"title"`
	Text     string `json:"text"`
	Image    string `json:"image"`
	ImageAlt string `json:"image_alt"`
	Link     string `json:"link"`
	Price    string `json:"price"`
}

type LayoutRevision added in v0.2.0

type LayoutRevision struct {
	ID           string   `json:"id"`
	ContentID    string   `json:"content_id"`
	Kind         string   `json:"kind"`
	AuthorID     string   `json:"author_id"`
	CreatedAt    string   `json:"created_at"`
	SectionCount int      `json:"section_count"`
	Summary      string   `json:"summary"`
	Document     Document `json:"document"`
}

LayoutRevision is one stored page-builder layout snapshot.

type Module

type Module struct{}

func New

func New() *Module

func (*Module) Catalogs

func (*Module) Catalogs() fs.FS

func (*Module) Migrations

func (*Module) Migrations() fs.FS

func (*Module) Name

func (*Module) Name() string

func (*Module) Register

func (*Module) Register(d *kernel.Deps) error

type ProvisionInput

type ProvisionInput struct{ Title, Template, Locale, Email string }

ProvisionInput selects a complete editable website for an empty tenant.

type Section

type Section struct {
	HeroScene string  `json:"hero_scene,omitempty"`
	Feed      string  `json:"feed,omitempty"`
	ID        string  `json:"id"`
	Kind      string  `json:"kind"`
	Variant   string  `json:"variant"`
	Title     string  `json:"title"`
	Text      string  `json:"text"`
	Image     string  `json:"image"`
	ImageAlt  string  `json:"image_alt"`
	Link      string  `json:"link"`
	LinkLabel string  `json:"link_label"`
	Items     []Entry `json:"items"`
	Hidden    bool    `json:"hidden"`
}

func DefaultSection

func DefaultSection(kind, locale string) Section

Jump to

Keyboard shortcuts

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