Documentation
¶
Overview ¶
Package served shapes a stored item the way every public seam answers it.
Index ¶
- Constants
- func InlineMedia(ctx context.Context, library Library, t content.Type, values content.Values) error
- func InlineTargets(ctx context.Context, links Reader, t content.Type, values content.Values) error
- func MediaIDs(t content.Type, values content.Values) []int64
- func PerPage(ctx context.Context, settings Settings) int
- func Pointing(ctx context.Context, stores Stores, t content.Type, c content.Content, ...) (map[string]int, error)
- func Values(ctx context.Context, stores Stores, t content.Type, c content.Content) (content.Values, map[string]int, error)
- type File
- type Groups
- type Library
- type Pointer
- type Reader
- type Settings
- type Stores
- type SubSize
- type Target
Constants ¶
const MediaPrefix = "/media"
MediaPrefix is the URL prefix uploads are served under.
Variables ¶
This section is empty.
Functions ¶
func InlineMedia ¶
InlineMedia rewrites every media key the type declares into the files it names, dropping what is gone.
func InlineTargets ¶ added in v0.13.0
InlineTargets rewrites every relation key the type declares into the items it names, dropping what is gone.
func PerPage ¶
PerPage returns how many items a public answer lists at once, as the site chose or by default.
Types ¶
type File ¶
type File struct {
ID int64 `json:"id"`
Src string `json:"src"`
Title string `json:"title"`
AltText string `json:"alt_text"`
Caption string `json:"caption"`
MimeType string `json:"mime_type"`
Width int `json:"width"`
Height int `json:"height"`
Sizes map[string]SubSize `json:"sizes"`
}
File is one library file as a public reader sees it.
type Groups ¶
type Groups interface {
Groups(ctx context.Context) ([]content.Group, error)
Params(ctx context.Context) *content.ParamRegistry
}
Groups reads the field groups a backlinks source resolves through.
type Pointer ¶
Pointer is one item pointing at another, named as a relation target and typed besides.
func NamedPointers ¶
NamedPointers returns the pointing items a public answer carries under one backlinks field.
type Reader ¶
type Reader interface {
TargetsByIDs(ctx context.Context, ids []uuid.UUID) ([]content.Target, error)
PointingAt(ctx context.Context, target uuid.UUID, field, page, perPage int) ([]content.Pointer, int, error)
}
Reader reads the items a public answer names beside the item's own values.
type SubSize ¶ added in v0.19.0
type SubSize struct {
Src string `json:"src"`
Width int `json:"width"`
Height int `json:"height"`
MimeType string `json:"mime_type"`
}
SubSize is one stored sub-size of a library file as a public reader sees it.
type Target ¶
Target is one item a relation points at, as a public reader sees it.
func NamedTargets ¶
NamedTargets returns the targets a public answer carries under one relation field.