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

taxonomy

package
v0.15.0 Latest Latest
Warning

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

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

Documentation

Overview

Package taxonomy manages taxonomies, terms and their assignment to content.

contract.go holds the frozen wave-0 contract (types and interfaces only). The implementation arrives in wave 1.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound: no such taxonomy or term.
	ErrNotFound = errors.New("taxonomy: not found")
	// ErrSystem: system taxonomies (category, tag) cannot be deleted.
	ErrSystem = errors.New("taxonomy: system taxonomy")
)

Functions

This section is empty.

Types

type Module

type Module struct{}

Module is the taxonomy kernel.Module.

func New

func New() *Module

New returns the taxonomy module.

func (*Module) Catalogs

func (*Module) Catalogs() fs.FS

Catalogs implements kernel.CatalogProvider.

func (*Module) Migrations

func (*Module) Migrations() fs.FS

Migrations implements kernel.Module.

func (*Module) Name

func (*Module) Name() string

Name implements kernel.Module.

func (*Module) Register

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

Register publishes taxonomy.Service (kernel.ServiceTaxonomy; content resolves it as its term backend), declares taxonomy.manage and mounts the admin screens, editor picker fragments and API operations.

type Service

type Service interface {
	Taxonomies(ctx context.Context) ([]Taxonomy, error)
	Get(ctx context.Context, slug string) (*Taxonomy, error)
	Save(ctx context.Context, t Taxonomy) error
	Delete(ctx context.Context, slug string) error
	Terms(ctx context.Context, taxonomy string, q TermQuery) ([]Term, int, error)
	GetTerm(ctx context.Context, id string) (*Term, error)
	GetTermBySlug(ctx context.Context, taxonomy, slug string) (*Term, error)
	SaveTerm(ctx context.Context, t Term) (*Term, error)
	DeleteTerm(ctx context.Context, id string) error
	SetContentTerms(ctx context.Context, contentID string, terms map[string][]string) error
	ContentTerms(ctx context.Context, contentID string) (map[string][]string, error)
	ContentIDs(ctx context.Context, taxonomy string, termSlugs []string) ([]string, error)
}

type Taxonomy

type Taxonomy struct {
	Slug         string            `json:"slug"`
	Name         map[string]string `json:"name"`
	Singular     map[string]string `json:"singular"`
	Hierarchical bool              `json:"hierarchical"`
	Public       bool              `json:"public"`
	System       bool              `json:"system"`
	Types        []string          `json:"types"`
}

type Term

type Term struct {
	ID          string         `json:"id"`
	Taxonomy    string         `json:"taxonomy"`
	Slug        string         `json:"slug"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	ParentID    string         `json:"parent_id"`
	Meta        map[string]any `json:"meta"`
	Count       int            `json:"count"`
}

type TermQuery

type TermQuery struct {
	Search   string `json:"search"`
	ParentID string `json:"parent_id"`
	Page     int    `json:"page"`
	PerPage  int    `json:"per_page"`
}

Jump to

Keyboard shortcuts

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