posttype

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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