posttype

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package posttype is the kernel's content-type discovery index. Modules declare the types they provide via kernel.ContentTypeProvider; core collects the declarations into this registry after InitAll. It answers only "which types exist and which slugs are reserved" — rich definitions (fields, validation, templates) stay in module domains.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicatePostType = errors.New("kernel: duplicate post type")
	ErrEmptyPostTypeSlug = errors.New("kernel: post type slug cannot be empty")
)

Functions

This section is empty.

Types

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is the process-wide index of content types. Register order never matters; All returns slugs sorted. Protected slugs (claimed by built-in modules) are recorded so later phases can refuse overrides.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty post-type registry.

func (*Registry) All

func (r *Registry) All() []kernel.PostTypeDef

All returns every registered definition in slug-sorted order.

func (*Registry) CollectFrom

func (r *Registry) CollectFrom(reg *kernel.Registry) error

CollectFrom gathers every ContentTypeProvider in the module registry into r, in module-name order. The first duplicate slug aborts the collection.

func (*Registry) GetBySlug

func (r *Registry) GetBySlug(slug string) (kernel.PostTypeDef, bool)

GetBySlug returns the definition registered under slug.

func (*Registry) IsProtected

func (r *Registry) IsProtected(slug string) bool

IsProtected reports whether the slug was claimed as protected by a module.

func (*Registry) Register

func (r *Registry) Register(def kernel.PostTypeDef) error

Register adds a type definition. Duplicate slugs are rejected.

func (*Registry) Slugs

func (r *Registry) Slugs() []string

Slugs returns every registered slug in sorted order.

Jump to

Keyboard shortcuts

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