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

content

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

Content module

modules/content is the pages and posts a tenant's public site is made of: a rest.Spec at /api/v1/content/contents with the draft, published and archived lifecycle and its events, a public read at /api/v1/content/public/{slug} that answers only for published rows, and the Markdown renderer contracts.Render the web module uses. content:read and content:manage guard the routes and the admin entry at /admin/content/contents. There are no versions by design; see module.go.

Compose it with content.Deps{}; it needs nothing from other modules. Consumers import contracts/ and its fake, never internal/. make test TEST_PACKAGES=./modules/content/... needs the development database.

Documentation

Overview

Package content is the module manifest: the pages and posts a tenant's public site is made of.

It is the shape every module follows: contracts/, internal/, and one exported function taking a struct of typed dependencies and returning a module.Module. Two absences are decisions rather than omissions.

There are no versions. A history table, a diff, a restore and a retention rule are a module of their own, and the private catalogue has one; what a reference architecture owes is the lifecycle — draft, published, archived — and the events that announce it.

There is no stored HTML. The body is Markdown and the public route renders it on read, through goldmark with raw HTML left out and bluemonday over the result, so a policy that tightens applies to everything ever written instead of to whatever is saved next. See internal/render.go.

Index

Constants

This section is empty.

Variables

View Source
var Migrations = db.MigrationSource{
	Owner:  "content",
	Files:  db.Sub(schema, "migrations"),
	Adopts: []db.Adoption{{Owner: "platformkit", Versions: []int64{17}}},
}

Migrations is this module's SQL as one source — the contents table — owned as "content". The manifest hands the kernel the same files and adoption, and a test composes the schema it needs beside the foundation: dbtest.Schema(t, content.Migrations).

The files keep the version numbers they had when the foundation applied them under its own name, so an installation migrated before this module owned its SQL is adopted by checksum rather than migrated again (see db.Adoption and docs/adr/0011). New files continue from the highest number.

Functions

func Module

func Module(_ Deps) (contracts.Service, module.Module)

Module is the manifest. The implementation is constructed here, in one line, and handed to the one place that uses it.

Types

type Deps

type Deps struct{}

Deps is what this module cannot make for itself, and it is empty: content belongs to a tenant by carrying its id, which row-level security matches on, and the author comes off the request's own context. It is a struct rather than no parameter so that the day it needs something, every call site gains a named field instead of a new argument.

Directories

Path Synopsis
Package contracts is everything another module, an app or a test may know about content: the entity, the events, the permissions and the Service interface.
Package contracts is everything another module, an app or a test may know about content: the entity, the events, the permissions and the Service interface.
contenttest
Package contenttest is the conformance suite for contracts.Service, and a fake that passes it.
Package contenttest is the conformance suite for contracts.Service, and a fake that passes it.
Package internal is every implementation of the content module.
Package internal is every implementation of the content module.

Jump to

Keyboard shortcuts

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