modulekit

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package modulekit - the module SDK: what the engine hands a module at startup (Deps) and what the module hands back (Parts), and everything else a module uses of the core: its controllers' base, the hooks, the core's types and helpers. A module's Wire builds its repositories, services and controllers from Deps and returns Parts - its routes, its content types' pages, its 404-path fallback, its uninstall step; the engine calls the Wire of each module it has (its own, and those registered with Register) and knows none by name.

A module from its own repository imports this package, its subpackages and the engine's pkg/*, nothing else of the engine. The data types are the core's own (type aliases), so a module and the core speak the same types; the services and repositories a module gets are interfaces with what a module needs. The SDK may change before the engine's 1.0 (the documentation's "The module SDK").

Index

Constants

View Source
const (
	FieldTypeText     = entity.FieldTypeText
	FieldTypeTaxonomy = entity.FieldTypeTaxonomy
	FieldTypeImage    = entity.FieldTypeImage
	FieldTypeLink     = entity.FieldTypeLink
)

The field types a module looks for (ContentTypeFieldType).

View Source
const (
	FieldLayoutAll      = entity.FieldLayoutAll
	FieldLayoutFeatured = entity.FieldLayoutFeatured
	FieldLayoutFirst    = entity.FieldLayoutFirst
)

The layouts of FieldLayout.

View Source
const (
	PermAdministerContent = service.PermAdministerContent
	PermAccessAdmin       = service.PermAccessAdmin
	PermViewUnpublished   = service.PermViewUnpublished
)

The core's permissions a module checks.

View Source
const (
	CommentModeOpen   = entity.CommentModeOpen
	CommentModeClosed = entity.CommentModeClosed
	CommentModeHidden = entity.CommentModeHidden
)

The comment modes.

View Source
const (
	BlockPlacementPlugin = entity.BlockPlacementPlugin
	BlockVisibilityAll   = entity.BlockVisibilityAll
)

A block placement's kind and visibility (BlockPlacement.PlacementType, VisibilityScope).

View Source
const (
	PluginBlockSettingNumber = entity.PluginBlockSettingNumber
	PluginBlockSettingSelect = entity.PluginBlockSettingSelect
	PluginBlockSettingText   = entity.PluginBlockSettingText
)

The kinds of a plugin block's setting.

View Source
const (
	RequirementOK      = entity.RequirementOK
	RequirementWarning = entity.RequirementWarning
	RequirementError   = entity.RequirementError
)

The outcomes of a check.

View Source
const (
	ActionToneCreate = audit.ToneCreate
	ActionToneChange = audit.ToneChange
	ActionToneDelete = audit.ToneDelete
	ActionToneAccess = audit.ToneAccess
	ActionToneLogin  = audit.ToneLogin
	ActionToneFail   = audit.ToneFail
)

The tones of action types (ActionType.Tone).

View Source
const (
	CommentPublished      = entity.CommentPublished
	CommentPending        = entity.CommentPending
	CommentSpam           = entity.CommentSpam
	CommentReasonReported = entity.CommentReasonReported
)

The comments' states (Comment.Status) and the reason of one held after visitors' complaints (Comments.Hold; CommentReason makes "reported:<count>").

View Source
const (
	RequestThemeKey    = service.RequestThemeKey
	RequestLanguageKey = service.RequestLanguageKey
	RequestLocationKey = service.RequestLocationKey
)

RequestThemeKey - the data key of the theme a fragment renders in (RenderNamed), RequestTheme its value; RequestLanguageKey and RequestLocationKey - of its language and its page's address.

View Source
const (
	FormMenuLink        = interfaces.FormMenuLink
	FormBlock           = interfaces.FormBlock
	FormBlockPlacement  = interfaces.FormBlockPlacement
	FormTerm            = interfaces.FormTerm
	FormSiteInformation = interfaces.FormSiteInformation
	FormView            = interfaces.FormView
	FormField           = interfaces.FormField
)

The core's admin forms with module sections (FormSection.Form; ref - the thing's id): a menu link's, a custom block's, a block placement's.

View Source
const (
	TextMenuLinkTitle        = entity.TextMenuLinkTitle
	VisibilityMenuLink       = entity.VisibilityMenuLink
	TextBlockTitle           = entity.TextBlockTitle
	TextPlacementTitle       = entity.TextPlacementTitle
	VisibilityBlockPlacement = entity.VisibilityBlockPlacement
	TextTermName             = entity.TextTermName
	TextTermDescription      = entity.TextTermDescription
	TextSiteName             = entity.TextSiteName
	TextSiteSlogan           = entity.TextSiteSlogan
	TextViewTitle            = entity.TextViewTitle
	TextViewDescription      = entity.TextViewDescription
	TextFieldLabel           = entity.TextFieldLabel
)

The kinds of the site's texts and things shown by language (SetTextTranslator, SetLanguageVisibility).

View Source
const (
	RoleAnonymous = entity.RoleAnonymous
	RoleUser      = entity.RoleUser
)

RoleAnonymous - the guests' role; RoleUser - every signed-in user's.

View Source
const AdminNodesSortTitle = entity.AdminNodesSortTitle

AdminNodesSortTitle - AdminNodesFilter.SortBy: by title.

View Source
const MaxMetaDesc = entity.MaxMetaDesc

MaxMetaDesc - the longest meta description, in characters.

View Source
const PermAdministerComments = service.PermAdministerComments

PermAdministerComments - the core's permission to moderate comments.

View Source
const PermFullAccess = service.PermFullAccess

PermFullAccess - the permission of every permission (the administrator role's).

View Source
const SiteTextRef = entity.SiteTextRef

SiteTextRef - the ref of the site's own texts (TextSiteName…).

View Source
const UserStatusActive = entity.UserStatusActive

UserStatusActive - User.Status of an active account (not blocked, not awaiting approval).

Variables

View Source
var (
	MailSitePlaceholders = entity.MailSitePlaceholders
	MailUserPlaceholders = entity.MailUserPlaceholders
)

MailSitePlaceholders and MailUserPlaceholders - the placeholders of every email and of an email about a user, for MailDef.Placeholders.

View Source
var ErrEntityNotFound = entity.ErrEntityNotFound

ErrEntityNotFound - a repository's answer for a missing record (IsNotFound; schemakit.ErrEntityNotFound for a module's generated ent).

View Source
var ErrNodeNotCopyable = interfaces.ErrNodeNotCopyable

ErrNodeNotCopyable - CopyNode's node can't be copied.

Functions

func AbsoluteAssetURL

func AbsoluteAssetURL(base, uri string) string

AbsoluteAssetURL - uri (a file's address) absolute on base.

func AddAccountSettingsSection

func AddAccountSettingsSection(s AccountSettingsSection)

AddAccountSettingsSection registers the module's section of the "Account settings" page, rendered by its template "account_settings_<module>": called once, from Wire.

func AddActionGroup

func AddActionGroup(g ActionGroup)

AddActionGroup registers a group of the module's actions (Group.Module - the module) and AddActionType its actions. Called once, from Wire.

func AddActionType

func AddActionType(t ActionType)

AddActionType - see AddActionGroup.

func AddAdminMenuCount

func AddAdminMenuCount(module, path string, count func(ctx context.Context) (int, error), label ...string)

AddAdminMenuCount sets the number the module shows by the admin menu item at path (its own, its manifest's AdminMenu, or the core's - shown with the module off too, without the number then): what waits there, e.g. new reports; counted for each admin page while the item is shown, 0 - none; label (i18n.N, optional) - what it counts, where the admin's Overview lists it ("" - the item's label). Called once, from Wire.

func AddContentTypeSettings

func AddContentTypeSettings(s ContentTypeSettings)

AddContentTypeSettings registers the module's section of the content type form: called once, from Wire.

func AddCreateLinks(module string, fn func(ctx context.Context, user *User, auth AuthService) []CreatableMaterialLink)

AddCreateLinks registers fn adding the module's items to the "Create" menu of the user: called once, from Wire.

func AddDashboardBlock

func AddDashboardBlock(b DashboardBlock)

AddDashboardBlock adds the module's block to the admin's Overview (shown while the module is enabled, to whom has b.Permission). Called once, from Wire.

func AddEmbedKind

func AddEmbedKind(k EmbedKind)

AddEmbedKind adds the module's kind of embedded thing (its Module set: off with the module).

func AddFieldFormatter

func AddFieldFormatter(f FieldFormatter)

AddFieldFormatter registers the module's field formatter. Called once, from Wire.

func AddFileStorage

func AddFileStorage(d FileStorage)

AddFileStorage adds a file storage, from the package's init: importing the package ("_" in the site's main package, app module add) is all it takes. A name already taken panics at startup.

func AddFormSection

func AddFormSection(s FormSection)

AddFormSection registers the module's section of a core admin form: called once, from Wire; used only while the module is on.

func AddJob

func AddJob(module string, j Job)

AddJob registers a background job of module: the scheduler runs it every j.Every while the module is enabled. Called once, from Wire.

func AddMail

func AddMail(d MailDef)

AddMail adds the module's email to the site's (the Mail page, Deps.Mail's Send): listed while the module is on. Called once, from Wire.

func AddMailTransport

func AddMailTransport(t MailTransport)

AddMailTransport adds a way of sending email, from the module's init. A mistake in it (a name not allowed or taken, no New) panics at startup.

func AddNodePage

func AddNodePage(module string, fn func(ctx context.Context, node Node) NodePageParts)

AddNodePage registers fn adding the module's parts to a material's page (links, actions): called once, from Wire.

func AddNodeSettings

func AddNodeSettings(s NodeSettings)

AddNodeSettings registers the module's section of the material form: called once, from Wire.

func AddPageData

func AddPageData(module string, fn func(r *http.Request, data map[string]any))

AddPageData registers fn adding the module's data to every page the site renders (e.g. its form on every page): called once, from Wire.

func AddPathOwner

func AddPathOwner(module string, answers func(ctx context.Context, path string) (bool, error))

AddPathOwner registers answers, telling whether the module answers a path of its own (no leading "/"; a feed's address): a View page or another module's page doesn't take it (PathOwner). Called once, from Wire, under the module's name.

func AddProfileTab

func AddProfileTab(t ProfileTab)

AddProfileTab registers the module's profile tab: called once, from Wire. It is shown only while the module is enabled.

func AddSitemapPaths

func AddSitemapPaths(module string, fn func(ctx context.Context) ([]string, error))

AddSitemapPaths registers fn adding the module's pages to the sitemap: called once, from Wire.

func AddTermPage

func AddTermPage(module string, fn func(ctx context.Context, term TaxonomyTerm) any)

AddTermPage registers the module's part of term pages: fn's result is the data of its templates there (.moduleTerm.<module>, e.g. its "term_actions_<module>"). Called once, from Wire; it runs only while the module is enabled.

func AddTextFilter

func AddTextFilter(f TextFilter)

AddTextFilter registers the module's text filter. Called once, from Wire.

func AddUserMenuCount

func AddUserMenuCount(data map[string]any, n int)

AddUserMenuCount adds n to the number on the user menu's toggle (data["userMenuCount"], e.g. the module's unread items), from the module's AddPageData.

func AddUserSettingsSection

func AddUserSettingsSection(s UserSettingsSection)

AddUserSettingsSection registers the module's section of the profile form, rendered by its template "user_settings_<module>": called once, from Wire.

func AddViewField

func AddViewField(f ViewField)

AddViewField registers the module's field: called once, from Wire.

func AddViewFilter

func AddViewFilter(f ViewFilter)

AddViewFilter registers the module's filter: called once, from Wire.

func AddViewSort

func AddViewSort(s ViewSort)

AddViewSort registers the module's sort criterion: called once, from Wire. It is offered and applied while the module is on.

func ApplySiteLanguages

func ApplySiteLanguages(def string, others []SiteLanguage)

ApplySiteLanguages makes def the running site's default language and others its other languages - once they are saved (SiteInformationRepository.Update, SetLanguages).

func AsGuest

func AsGuest(ctx context.Context) (context.Context, error)

AsGuest - ctx whose content queries see only what a guest may view (the content closed to guests left out): for output that is public by nature and kept by any cache, whoever asks (a feed).

func AuthJSONMiddleware

func AuthJSONMiddleware(store *sessions.CookieStore) func(http.Handler) http.Handler

AuthJSONMiddleware - AuthMiddleware for a JSON endpoint (a guest gets a JSON error, not the login page).

func AuthMiddleware

func AuthMiddleware(store *sessions.CookieStore) func(http.Handler) http.Handler

AuthMiddleware - the user signed in by the session (Routes.Store), for the module's routes that need to know them.

func ChangeNode

func ChangeNode(ctx context.Context, nodeID int, user *User, change func(ctx context.Context) error) error

ChangeNode runs change of the node nodeID by user (its publishing, say) in one transaction, recorded in its history - a revision, the action log, OnNodePublished - as the bulk actions' changes are.

func CheckBotTrap

func CheckBotTrap(r *http.Request) error

CheckBotTrap - an error when r's form looks sent by a bot: the site's bot trap (its fields - the template's {{botTrap}} in the form) caught it; nil when it passes or the trap is off.

func CommentReason

func CommentReason(code, detail string) string

CommentReason - a hold reason with its detail ("reported:3").

func CommentsPerPage

func CommentsPerPage() int

CommentsPerPage - the comments a material's page shows at a time.

func ContextUserID

func ContextUserID(ctx context.Context) (int, bool)

ContextUserID - the signed-in user of the request ctx belongs to (a handler's r.Context(), a node or term page's hook: AddNodePage, AddTermPage); false - a guest.

func CopyNode

func CopyNode(ctx context.Context, nodeID int, user *User, title string) (int, error)

CopyNode creates a copy of the node nodeID (an admin-created type's) by user: its fields' values, flags and view roles, titled title ("" - "Copy of …"), unpublished, with an address of its own, in ctx's language (i18n.WithLang): its id. ErrNodeNotCopyable - a field set's item or a module's content type's.

func DBDialect

func DBDialect() string

DBDialect - the database the site runs on (dialect.MySQL, dialect.Postgres): a module's own ent client opens its driver on Deps.DB with it.

func DocumentAllowed

func DocumentAllowed(name string, head []byte) bool

DocumentAllowed - whether a file a visitor sends (name, its first bytes) may be kept: not of an extension never accepted (pages, scripts, programs), not content a browser could run (HTML, SVG, scripts, executables) whatever the name - the core's own check of documents.

func Driver

func Driver(ctx context.Context, db *sql.DB) dialect.Driver

Driver - the module's own ent client's driver for ctx (its generated NewClient(Driver(…))): the context's transaction (InTx), else db.

func EmbedTemplate

func EmbedTemplate(ctx context.Context, templates TemplateService, define string, data map[string]any) (template.HTML, error)

EmbedTemplate renders an embedded thing: the template define (one of the module's templates/blocks/*.html, always parsed along) with data, in the zone, language and theme of ctx's request.

func EscapePathSegments

func EscapePathSegments(rel string) string

EscapePathSegments - rel with each of its path segments escaped.

func FileIDs

func FileIDs(v any) []int

FileIDs - the files of an image or file field's value: one, or several in order for a field with several images (FieldInstanceDef.Multiple).

func FirstFileID

func FirstFileID(v any) int

FirstFileID - the first file of an image or file field's value (0 - none): where one picture stands for the content.

func FormPreviewPath

func FormPreviewPath(contentType string, nodeID int) string

FormPreviewPath - where the form of a new item of contentType (nodeID 0) or of the item nodeID sends its preview: the content form's "formPreviewURL" (its Preview button).

func ImageFormatsLabel

func ImageFormatsLabel(mimes []string) string

ImageFormatsLabel - the image formats of a MIME allow-list as people know them ("JPEG, PNG"; FileUploadService.ImageTypes).

func ImageMIME

func ImageMIME(uri string) string

ImageMIME - an image's media type by its address.

func InTx

func InTx(ctx context.Context, db *sql.DB, fn func(ctx context.Context) error) error

InTx runs fn in a transaction, the core's unit of work on db (inside one, fn joins it): the core's repositories called with fn's ctx write in it, and so does the module's own client opened with Driver(ctx, db).

func IsDuplicateKey

func IsDuplicateKey(err error) bool

IsDuplicateKey - err is a unique key's violation.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound - err says the record is missing (ErrEntityNotFound, the module's generated ent's not-found error, wrapped or not): a handler answers 404 for it (RenderLoadFailure does).

func IsValidCommentMode

func IsValidCommentMode(s string) bool

IsValidCommentMode - whether s is a comment mode.

func LocalPath

func LocalPath(code, path string) string

LocalPath - path in code's addresses: with its prefix, as is for the default language.

func LogFallback

func LogFallback(logger *slog.Logger, err error, msg string, args ...any)

LogFallback logs err of a fallback the module goes on with (a default value, an empty list): debug for a missing record, else warn.

func MailBaseURL

func MailBaseURL() string

MailBaseURL - the site's address for links in e-mails.

func MailTemplatePath

func MailTemplatePath(key string) string

MailTemplatePath - the edit page of the email key on the Mail page (a module's settings linking to its email's text).

func ModuleEnabled

func ModuleEnabled(name string) bool

ModuleEnabled - whether the module name is on (the Modules page).

func ModuleNodeData

func ModuleNodeData(ctx context.Context, node Node) map[string]any

ModuleNodeData - the modules' data for a material's page (AddNodePage parts and the like), for a module rendering its own material page.

func ModuleNodeTypePathPrefix

func ModuleNodeTypePathPrefix(nodeType string) string

ModuleNodeTypePathPrefix - the path prefix of a module's content type's materials ("<type>/").

func NodeRelPath

func NodeRelPath(nodeType ContentType, slug string) string

NodeRelPath - a material's address (without the leading slash) from its type and slug.

func NodeTypeEnabled

func NodeTypeEnabled(nodeType string) bool

NodeTypeEnabled - whether content of nodeType is available: false for a type of a disabled module.

func OnAction

func OnAction(module string, fn func(ctx context.Context, e ActionEvent))

OnAction adds the module's listener of the recorded actions - the action log's; it runs in the acting request (quick, its errors its own). Called once, from Wire; module "" - always (a test's).

func OnNodeFormSaved

func OnNodeFormSaved(module string, fn func(ctx context.Context, node Node, isNew bool) error)

OnNodeFormSaved registers fn, called while module is enabled after a content item's own form (create or edit) saved it, in the save's transaction - its error fails the save; node has the ID and Type. Changes made elsewhere (bulk actions, publishing, the schedule, a copy) don't call it. Called once, from Wire.

func OnNodePublished

func OnNodePublished(module string, fn func(ctx context.Context, node Node) error)

OnNodePublished registers fn, called when a content item becomes public (published and not on moderation): created so, or by its form, its publishing, the bulk actions or the schedule - while module is enabled. It runs in the change's transaction; its error is logged. Called once, from Wire.

func OnNotFound

func OnNotFound(module string, fn func(ctx context.Context, path, referrer string))

OnNotFound adds the module's hook told of every page request answered 404 - its path (no query) and referrer; a redirected path or a blocked request never gets there. It runs in the request after the answer: quick, its errors its own. Called once, from Wire.

func OptionalAuthMiddleware

func OptionalAuthMiddleware(store *sessions.CookieStore) func(http.Handler) http.Handler

OptionalAuthMiddleware - the user signed in by the session when there is one; a guest goes on.

func OrderRandom

func OrderRandom(s *entsql.Selector)

OrderRandom - an ent order option shuffling the rows, in the site's database's own way.

func PathOwner

func PathOwner(ctx context.Context, path, module string) (string, error)

PathOwner - what answers path on the site besides the module ("" - nothing: the address is free for it): the engine's routes ("routes"), content ("content"), a View page ("views"), a term page ("terms") or another module's page (that module's name).

func PermEditAny

func PermEditAny(nodeType string) string

PermEditAny - the permission to edit anyone's material of nodeType.

func PlainPreview

func PlainPreview(s string, limit int) string

PlainPreview - the start of s as plain text, its code blocks left out, at most limit characters.

func PrivateFiles

func PrivateFiles() filestore.Store

PrivateFiles - the store of the private files (on disk or in a bucket), never served as they are: a module serves them itself, after its own access check.

func PublicBaseURL

func PublicBaseURL(r *http.Request) string

PublicBaseURL - the site's address for the request (absolute links).

func PublicFiles

func PublicFiles() filestore.Store

PublicFiles - the store of the public files (on disk or in an object storage): a module keeps files of its own there under a folder named after it; a file's key is its path under PublicFilesURL.

func PublicFilesURL

func PublicFilesURL() string

PublicFilesURL - the address of the public files (uploads).

func RSSPostURL

func RSSPostURL(base string, n Node) string

RSSPostURL - a material's absolute address in a feed.

func Rebind

func Rebind(query string) string

Rebind - a hand-written query's ? placeholders in the site's database's own (a module's SQL on Deps.DB).

func RecordAction

func RecordAction(ctx context.Context, a Action)

RecordAction records what the module did for the action log: who did it (the request's user and address) comes from ctx. Without an action log it costs nothing.

func RecordNodeCreated

func RecordNodeCreated(ctx context.Context, n Node)

RecordNodeCreated records for the action log that the module's own save created the content n ("Content created"). The core's content form records it itself; a module type saved by the module's code calls it.

func RecordNodeSaved

func RecordNodeSaved(ctx context.Context, before, after Node)

RecordNodeSaved records what the module's own save changed of the content (before and after it): published or unpublished, a new author, a new address - as the core's content form does.

func Register

func Register(r Registration)

Register adds a module from outside the engine: called from the module's package init, so importing the package ("_" in the site's main package) is all it takes - the engine lists it after its own. A name the engine has already panics at startup.

func RequestTheme

func RequestTheme(ctx context.Context) string

RequestTheme - the theme of the request's render (a previewed one), "" - the active theme.

func SafeRedirectPath

func SafeRedirectPath(destination string) string

SafeRedirectPath - destination when it is a path of this site (a "back" link of a form), else "".

func SetContentListFilter

func SetContentListFilter(module string, fn func(ctx context.Context) func(*entsql.Selector))

SetContentListFilter sets what narrows the content lists' nodes - every content View's, the search's - for a request, while module is enabled: fn(ctx) returns the condition the nodes' query adds (on its selector: s.C("langcode") is the nodes' column), nil - none for ctx. Called once, from Wire.

func SetLanguageVisibility

func SetLanguageVisibility(module string, fn func(kind, ref, lang string) bool)

SetLanguageVisibility sets what says whether a thing (kind, ref: a menu link…) shows on a page in a language, while module is enabled (off - in every language).

func SetLanguagesSwitch

func SetLanguagesSwitch(module string)

SetLanguagesSwitch makes the site's languages besides the default one in use - their prefixes, their addresses - while module is enabled: called once, from the languages module's Wire; none set (module "") - one language.

func SetNodeURLsInLanguage

func SetNodeURLsInLanguage(module string, fn func(ctx context.Context, ids []int, lang string) map[int]string)

SetNodeURLsInLanguage sets what gives content items' addresses in a language - their public versions in it - while module is enabled.

func SetNodeWorkflow

func SetNodeWorkflow(w NodeWorkflow)

SetNodeWorkflow sets the site's editorial workflow: called once, from Wire; used only while the module is on.

func SetPluginBlockData

func SetPluginBlockData(id PluginBlockID, load func(ctx context.Context, p BlockPlacement) (any, error))

SetPluginBlockData sets the loader of the module's plugin block id's data: called once, from Wire. Every refresh of the blocks' cache calls load for each of the block's placements; its result is the block template's .Data (templates don't query the database).

func SetPluginBlockSettings

func SetPluginBlockSettings(id PluginBlockID, list func(ctx context.Context) ([]PluginBlockSetting, error))

SetPluginBlockSettings sets the settings of the module's plugin block id, offered on its placement page and kept with the placement: called once, from Wire; list - on every page and save (its options may come from the database).

func SetPluginBlockTargets

func SetPluginBlockTargets(id PluginBlockID, list func(ctx context.Context) ([]PluginBlockTarget, error))

SetPluginBlockTargets sets what the module's plugin block id can show (the placement page's choice): called once, from Wire.

func SetTextTranslator

func SetTextTranslator(module string, fn func(lang, kind, ref string) (string, bool))

SetTextTranslator sets what gives a text of the site (a menu link's title…: kind, ref) in a language (false - none, the text as entered), while module is enabled. Called once, from the languages module's Wire.

func SiteDomain

func SiteDomain() string

SiteDomain - the site's address (public_base_url), "" when not set.

func TruncateMeta

func TruncateMeta(s string, n int) string

TruncateMeta - s cut for a meta description of at most n characters.

func UserMailTokens

func UserMailTokens(baseURL string, site *SiteInformation, u *User) mailtemplate.TokenData

UserMailTokens - the tokens of an account e-mail to u ([site:…], [user:…], mailtemplate) under the site's address baseURL.

func UserRoleNames

func UserRoleNames(u *User) []string

UserRoleNames - the roles of u (a guest's for nil; every signed-in user has RoleUser too).

func WithContentVisitor

func WithContentVisitor(ctx context.Context, v ContentVisitor) context.Context

WithContentVisitor - ctx whose content and comment queries leave out what v may not view: a background job working for one user (their e-mail) sees what they may (AuthService.ContentVisitor).

Types

type AccountSettings

type AccountSettings = entity.AccountSettings

AccountSettings - the account settings (the "Account settings" page's data, .account).

type AccountSettingsSection

type AccountSettingsSection = interfaces.AccountSettingsSection

AccountSettingsSection - a module's section of the "Account settings" page (its settings of accounts).

type Action

type Action = audit.Action

Action - what was done: its Type, the Object it was done to, the Changes.

type ActionActor

type ActionActor = audit.Actor

ActionActor - who did an action: the user, the address.

func ActionActorFrom

func ActionActorFrom(ctx context.Context) ActionActor

ActionActorFrom - who acts in ctx: the signed-in user and the address (zero - nobody known).

type ActionChange

type ActionChange = audit.Change

ActionChange - one changed value of an action.

type ActionEvent

type ActionEvent = audit.Event

ActionEvent - a recorded action, with who did it and when.

type ActionGroup

type ActionGroup = audit.Group

ActionGroup - a module's kind of actions: its group shows on the log's filter and settings.

func ActionGroups

func ActionGroups() []ActionGroup

ActionGroups - the groups of actions (the core's first), ActionTypeOf - an action type by name: for an action log's pages.

type ActionObject

type ActionObject = audit.Object

ActionObject - what an action was done to.

func NodeActionObject

func NodeActionObject(n Node) ActionObject

NodeActionObject - the content n as the object of a module's action (RecordAction): the action shows in the content's log too.

type ActionType

type ActionType = audit.Type

ActionType - an action of a group: its Label, its Tone (ActionTone*).

func ActionTypeOf

func ActionTypeOf(name string) (ActionType, bool)

ActionTypeOf - see ActionGroups.

type AdminNodesFilter

type AdminNodesFilter = entity.AdminNodesFilter

AdminNodesFilter - a page of the admin's content list (NodesRepository.ListForAdmin): type, status, address, order.

type AuthService

type AuthService = service.AuthService

AuthService - who the user is and what they may (Deps.Base.Auth).

type BaseController

type BaseController = interfaces.BaseController

BaseController - what a module's controller embeds.

func NewBaseController

func NewBaseController(d BaseDeps) *BaseController

NewBaseController - a module's controller's base from d (Deps.Base).

type BaseDeps

type BaseDeps = interfaces.BaseDeps

BaseDeps - what it is built from (Deps.Base).

type BlockPlacement

type BlockPlacement = entity.BlockPlacementDef

BlockPlacement - where a block is placed (a region of a theme) and its settings (PluginSetting).

type BreadcrumbItem = entity.BreadcrumbItem

BreadcrumbItem - a link of a page's breadcrumbs.

type CaptchaService

type CaptchaService = service.CaptchaService

CaptchaService - the site's reCAPTCHA (Captcha).

func Captcha

func Captcha() *CaptchaService

Captcha - the reCAPTCHA in effect (nil - none set).

type Comment

type Comment = entity.Comment

Comment - a comment (Deps.Comments).

type CommentMode

type CommentMode = entity.CommentMode

CommentMode - a material's comments: open, closed, hidden.

type Comments

type Comments = entity.Comments

Comments - comments.

type CommentsService

type CommentsService interface {
	ByID(ctx context.Context, id int) (*Comment, error)
	// Approve publishes a comment waiting for approval or marked as spam.
	Approve(ctx context.Context, id int) error
	// Hold takes a published comment back to waiting for approval for
	// reason (CommentReason*).
	Hold(ctx context.Context, id int, reason string) error
	// MarkSpam marks the comment as spam: shown to nobody.
	MarkSpam(ctx context.Context, id int) error
	// Delete removes the comment together with all its replies.
	Delete(ctx context.Context, id int) error
	ByNodeIDPaginated(ctx context.Context, nid int, status int8, page int) (Comments, int, error)
	CountByNodeID(ctx context.Context, nid int, status int8, rootOnly bool) (int, error)
	// OnCommentPosted registers the module's fn, called after a published
	// comment is created (a reply too: its ParentID) while the module is
	// enabled: a module telling of it. Its error is logged; the comment
	// stands. Called once, from Wire.
	OnCommentPosted(module string, fn func(ctx context.Context, c Comment) error)
	// OnNodeCommentsChanged registers the module's fn, called after a
	// comment of a material is created, updated or deleted while the
	// module is enabled: a module keeping its own counts of a material's
	// comments updates them. Its error is logged; the comment's change
	// stands. Called once, from Wire.
	OnNodeCommentsChanged(module string, fn func(ctx context.Context, nodeID int) error)
}

CommentsService - the materials' comments (Deps.Comments).

type ContentType

type ContentType = entity.ContentType

ContentType - a content type's machine name.

func NodeTypesByLabel

func NodeTypesByLabel(labels map[string]string) []ContentType

NodeTypesByLabel - the node types of labels (ContentTypeService.NodeTypeLabels) sorted by label.

type ContentTypeDef

type ContentTypeDef = entity.ContentTypeDef

ContentTypeDef - a content type (Deps.ContentTypes).

type ContentTypeDefs

type ContentTypeDefs = entity.ContentTypeDefs

ContentTypeDefs - content types.

type ContentTypeFieldType

type ContentTypeFieldType = entity.ContentTypeFieldType

ContentTypeFieldType - a field's type (FieldType*).

type ContentTypeService

type ContentTypeService interface {
	ContentTypeByMachineName(ctx context.Context, machineName string) (*ContentTypeDef, error)
	// ContentTypes - the content types, not the field sets.
	ContentTypes(ctx context.Context) (ContentTypeDefs, error)
	FieldsByContentTypeID(ctx context.Context, contentTypeID int) (FieldInstanceDefs, error)
	FieldValues(ctx context.Context, nodeID int, fields FieldInstanceDefs) (map[int]any, error)
	SetFieldValues(ctx context.Context, nodeID int, fields FieldInstanceDefs, values map[int]any, textFormats map[int]int) error
	// NodeTypeLabels - every node type's label by machine name: the
	// content types' own and the modules' node types' (translated).
	NodeTypeLabels(ctx context.Context) map[string]string
}

ContentTypeService - the content types and the materials' field values (Deps.ContentTypes).

type ContentTypeSettings

type ContentTypeSettings = interfaces.ContentTypeSettings

ContentTypeSettings - a module's section in the content type's form.

type ContentVisitor

type ContentVisitor = entity.ContentVisitor

ContentVisitor - what of the content a visitor may not view (AuthService.ContentVisitor).

type CreatableMaterialLink = entity.CreatableMaterialLink

CreatableMaterialLink - an item of the "Create" menu (AddCreateLinks).

type DashboardBlock

type DashboardBlock = service.DashboardBlock

DashboardBlock - a module's block on the admin's Overview (/admin): its template dashboard_<Name> (the module's templates/partials), its card's Title (i18n.N) and "all" link, its column (Side), its Weight, the Permission it needs and its Data for the request.

type Deps

type Deps struct {
	// Base - what the module's controllers' base is built from
	// (NewBaseController); what the module itself needs of the core is
	// below.
	Base   BaseDeps
	DB     *sql.DB
	Logger *slog.Logger

	// Auth - who the user is and what they may.
	Auth AuthService
	// Templates - the site's templates.
	Templates TemplateService
	// SiteInformation - the site's name, e-mail and languages.
	SiteInformation SiteInformationRepository
	// RefreshBlocks rebuilds the blocks' cache (in the background): after
	// a change the cached blocks show that isn't a material's or a
	// comment's (those rebuild it themselves).
	RefreshBlocks func()

	Nodes        NodesService
	NodeRepo     NodesRepository
	NodeDeleter  NodeDeleter
	ContentTypes ContentTypeService
	Taxonomy     TaxonomyService
	Teasers      TeaserBuilder
	ImageStyles  ImageStyleService
	Comments     CommentsService
	FileUpload   FileUploader
	Files        FileRepository
	Users        UserRepository
	Mail         Mailer
	// UploadSettings - the site's upload policy (file size limit).
	UploadSettings UploadSettingsRepository
	// Redirects - the site's redirects (a module adding them).
	Redirects RedirectService
	// Roles - the site's roles (a module's choice of who may do
	// something).
	Roles interface {
		Roles(ctx context.Context) (Roles, error)
	}
	// Vocabularies - deleting a vocabulary nothing else uses (a module's
	// uninstall step).
	Vocabularies interface {
		DeleteVocabularyIfUnused(ctx context.Context, vid int) (bool, error)
	}
}

Deps - the core's database handles and services a module builds on.

type DynamicContent

type DynamicContent = entity.DynamicContent

DynamicContent - a material with its fields' values (the content form's data, .dc).

type EmbedKind

type EmbedKind = service.EmbedKind

EmbedKind - a kind of thing a text embeds with a tag [[<kind>:<name>]] (or a template with {{embed "<kind>:<name>"}}): Render gives what name embeds for its ctx's visitor (the request's: access, language, zone), ErrEntityNotFound for a missing one; Label, Search and Describe offer the kind in the editor's "Insert" window.

type EmbedOption

type EmbedOption = service.EmbedOption

EmbedOption - a thing of the module's kind as the editor shows it (the "Insert" window's list and preview, the card over its tag): EmbedKind's Search and Describe give them.

type FeedNodeFilter

type FeedNodeFilter = entity.FeedNodeFilter

FeedNodeFilter - the materials a feed takes (NodesRepository.ListForFeed).

type FieldFormatter

type FieldFormatter = service.FieldFormatter

FieldFormatter - a module's way of showing a field (a link field's videos, say), chosen per field on the content type's "Detail page" tab and per View field: Name (unique), Module, Label (i18n.N), FieldType, Render(ctx, value, layout) - the field's value (a link field's: Links) as HTML, cheap and without network, a part it can't show shown as the core does; Hosts - its sites, offered as a link field's allowed ones; EditorScript - its script (static/<name>.js) the content form loads for the fields it shows. Off with its module: the field shows as links.

type FieldInstanceDef

type FieldInstanceDef = entity.FieldInstanceDef

FieldInstanceDef - a content type's field.

type FieldInstanceDefs

type FieldInstanceDefs = entity.FieldInstanceDefs

FieldInstanceDefs - a content type's fields.

type FieldLayout

type FieldLayout = entity.FieldLayout

FieldLayout - how a field with several values shows them: all one after another, the first large and the others small (FieldLayoutFeatured), or the first only (FieldLayoutFirst - the formatter gets just that one).

type FieldUploadPolicy

type FieldUploadPolicy = entity.FieldUploadPolicy

FieldUploadPolicy - what an upload may be (extensions, size).

type File

type File = entity.File

File - an uploaded file (an image).

func OriginalImage

func OriginalImage(f File) File

OriginalImage - an image's original file's address.

func StyledImage

func StyledImage(f File, styleName string) File

StyledImage - an image's address in the image style styleName.

type FileRepository

type FileRepository interface {
	// Create records an uploaded file (its URI, type, size, dimensions)
	// by createdBy.
	Create(ctx context.Context, uri, mimeType string, width, height, sizeBytes int, createdBy int) (*File, error)
	// ByIDs - the files with these ids, by id (a missing one is absent).
	ByIDs(ctx context.Context, ids []int) (map[int]File, error)
}

FileRepository - the uploaded files (Deps.Files).

type FileStorage

type FileStorage = filestorage.Driver

FileStorage - a storage the site's files can be kept in besides its directories (files.storage, files.private_storage name it): Public opens the public files' store, Private the private files' (nil - none).

type FileStorageConfig

type FileStorageConfig = filestorage.Config

FileStorageConfig - what a FileStorage opens its store from: its own section of the config's files (Decode) and the environment.

type FileUploader

type FileUploader interface {
	// ImageTypes - the image MIME types the upload policy allows (empty -
	// every format the engine accepts, ImageFormatsLabel).
	ImageTypes(ctx context.Context) ([]string, error)
	// UploadImage saves an image to dir (relative to the public files,
	// e.g. a module's "galleries/12") under a unique name, checked by
	// policy (its zero limits - the site's); its public:// URI.
	UploadImage(ctx context.Context, file multipart.File, header *multipart.FileHeader, dir string, policy FieldUploadPolicy) (string, *UploadResult, error)
}

FileUploader - the uploads (Deps.FileUpload).

type FormSection

type FormSection = interfaces.FormSection

FormSection - a module's section of a core admin form: its template is "form_<Form>_<module>".

type ImageStyleDef

type ImageStyleDef = entity.ImageStyleDef

ImageStyleDef - an image style.

type ImageStyleDefs

type ImageStyleDefs = entity.ImageStyleDefs

ImageStyleDefs - image styles.

type ImageStyleService

type ImageStyleService interface {
	ImageStyles(ctx context.Context) (ImageStyleDefs, error)
	ImageStyleByName(ctx context.Context, name string) (*ImageStyleDef, error)
}

ImageStyleService - the image styles (Deps.ImageStyles).

type Job

type Job = service.Job

Job - a background job the site's scheduler runs: Name (unique, e.g. "<module>_digest"), Every (a minute at least), Run (its error is logged; a run may take up to 50 seconds).

type Link = entity.Link

Link - one value of a link field: its address and title (Text - the title, else the address; Host - its site).

func Links(v any) []Link

Links - a link field's value as a FieldFormatter gets it: its links.

type MailDef

type MailDef = entity.MailDef

MailDef - one of the site's emails, a module's (AddMail): its key ("<module>.<name>"), the Mail page's label, description and recipient (i18n.N), whether it can be switched off, its placeholders and their sample values, its default text (i18n.N); Load and Save when the module keeps the text itself (else the Mail page does).

type MailSender

type MailSender = mailsender.EmailSender

MailSender - what a MailTransport's New gives: it sends a message.

type MailTemplate

type MailTemplate = entity.MailTemplate

MailTemplate - an email's subject and body with placeholders.

type MailTransport

type MailTransport = service.MailTransport

MailTransport - a way of sending the site's email besides the engine's SMTP (an HTTP API of a mail service): its name, its module (it sends while the module is enabled), its title and settings on the Mail page, and New, building its sender from the saved settings.

type MailTransportField

type MailTransportField = service.MailTransportField

MailTransportField - a setting of a MailTransport: shown on the Mail page (a secret never shown back), set from the environment by Env.

type Mailer

type Mailer interface {
	SendPlain(to, subject, body string) error
	Send(ctx context.Context, key, to string, data mailtemplate.TokenData) error
}

Mailer - the site's e-mail (Deps.Mail): with e-mail off nothing is sent. Send sends one of the site's emails (AddMail) by its key: its template (the Mail page's text) with data's placeholders, unless it is switched off there; SendPlain - a message as given.

type Mux

type Mux interface {
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

Mux - where a module registers its routes (Go's net/http patterns).

type Node

type Node = entity.Node

Node - a material (a node).

func RequestNode

func RequestNode(r *http.Request) (*Node, bool)

RequestNode - the material the core's node access check put in the request (a module's content type pages).

type NodeDeleter

type NodeDeleter interface {
	// Delete deletes nodeID for good, whether in the trash or not.
	Delete(ctx context.Context, nodeID int) error
	// Remove takes nodeID out of sight as user's action: a content type's
	// item into the trash, a module's type's deleted (trashed - which).
	Remove(ctx context.Context, nodeID int, user *User) (trashed bool, err error)
	// AfterDelete adds a module's own cleanup of a deleted material
	// (files it keeps outside the database), run after every delete,
	// however the material was deleted: called once, from Wire.
	AfterDelete(fn func(ctx context.Context, n Node))
}

NodeDeleter - deleting a material with everything of it: its fields' values, comments, files nothing else uses, the modules' data (Deps.NodeDeleter).

type NodeFormPreviewer

type NodeFormPreviewer = interfaces.NodeFormPreviewer

NodeFormPreviewer - a module's content type whose form previews its item unsaved (FormPreviewPath; without it - no Preview button).

type NodeLink = interfaces.NodeLink

NodeLink - a link a module adds to a material's page.

type NodeMetaFields

type NodeMetaFields = form.NodeMetaFields

NodeMetaFields - a material form's title and description fields.

func NodeMetaFromPageSEO

func NodeMetaFromPageSEO(ps PageSEO) NodeMetaFields

NodeMetaFromPageSEO - the form fields of a material's page SEO.

type NodePageParts

type NodePageParts = interfaces.NodePageParts

NodePageParts - what a module adds to a material's page (AddNodePage).

type NodeSettings

type NodeSettings = interfaces.NodeSettings

NodeSettings - a module's section in the material's form.

type NodeTypeController

type NodeTypeController = interfaces.NodeTypeController

NodeTypeController - the pages of a module's content type (Parts.NodeTypes).

type NodeWorkflow

type NodeWorkflow = interfaces.NodeWorkflow

NodeWorkflow - a module's editorial workflow publishing some content types' items.

type Nodes

type Nodes = entity.Nodes

Nodes - materials.

type NodesRepository

type NodesRepository = entity.NodesRepository

NodesRepository - the materials (Deps.NodeRepo).

type NodesService

type NodesService = service.NodesService

NodesService - the materials' service (Deps.Nodes).

type PageSEO

type PageSEO = entity.PageSEO

PageSEO - a page's title and meta tags.

func PageSEOForList

func PageSEOForList(title, path string) PageSEO

PageSEOForList - a list page's title and meta tags (its canonical address path).

func PageSEOForPaginatedList

func PageSEOForPaginatedList(title, path string, page int, query url.Values) PageSEO

PageSEOForPaginatedList - PageSEOForList for page (of a paginated list) with the list's query.

type Parts

type Parts struct {
	// Routes registers the module's routes; their mux answers 404 while
	// the module is off.
	Routes func(Routes)
	// NodeTypes - the module's content types with pages of their own
	// (the node dispatcher sends their nodes there).
	NodeTypes map[entity.ContentType]interfaces.NodeTypeController
	// Fallback answers a path no route matched (a feed, a forum section)
	// while the module is on: true - answered.
	Fallback func(w http.ResponseWriter, r *http.Request) bool
	// Uninstall - the module's own uninstall step, run when the module is
	// deleted on the Modules page, after its content and before its tables.
	Uninstall func(ctx context.Context) error
	// Requirements - the module's lines of the status report (checked
	// only while it is enabled).
	Requirements StatusCheck
	// UserContent - the module's content of a user that "delete the
	// account and all its content" (/admin/people) counts and deletes too.
	UserContent *UserContent
}

Parts - what a wired module gives the core. Every field is optional.

type Picture

type Picture = imageurl.Picture

Picture - an image's <img> (the template function img): its address, other widths and size (StyledPicture).

func OriginalPicture

func OriginalPicture(f File) Picture

OriginalPicture - the image itself, for the template function img.

func StyledPicture

func StyledPicture(f File, styleName string) Picture

StyledPicture - an image in the image style styleName, for the template function img: its address, the style's other widths (srcset) and its size.

type PluginBlockID

type PluginBlockID = entity.PluginBlockID

PluginBlockID - a plugin block's id (the module's, its manifest's).

type PluginBlockSetting

type PluginBlockSetting = entity.PluginBlockSetting

PluginBlockSetting - one setting of a plugin block on its placement page (SetPluginBlockSettings); its value is the placement's PluginSetting "<Key>" in the block's template.

type PluginBlockSettingType

type PluginBlockSettingType = entity.PluginBlockSettingType

PluginBlockSettingType - a setting's kind: a number, a choice, a line of text.

type PluginBlockTarget

type PluginBlockTarget = entity.PluginBlockTarget

PluginBlockTarget - one thing a plugin block can show.

type ProfileTab

type ProfileTab = interfaces.ProfileTab

ProfileTab - a module's tab of the user profile (/me/<Path>, /<profile>/<Path>): who may open it, its badge, its data; its template is "profile_tab_<module>".

type RSSChannel

type RSSChannel = interfaces.RSSChannel

RSSChannel - the feed's channel: its title, address, items.

type RSSDoc

type RSSDoc = interfaces.RSSDoc

RSSDoc - an RSS document (its <rss>).

type RSSEnclosure

type RSSEnclosure = interfaces.RSSEnclosure

RSSEnclosure - an item's attached file (an image).

type RSSGUID

type RSSGUID = interfaces.RSSGUID

RSSGUID - an item's guid.

type RSSItem

type RSSItem = interfaces.RSSItem

RSSItem - a feed's item.

type RedirectService

type RedirectService interface {
	// Create adds a redirect from the path from to to.
	Create(ctx context.Context, from, to string) error
	// GetRedirect - where fromPath redirects to.
	GetRedirect(fromPath string) (toPath string, ok bool)
}

RedirectService - the site's redirects (Deps.Redirects).

type Region

type Region = entity.Region

Region - a theme's region (BlockPlacement.Region).

type Registration

type Registration struct {
	Module manifestkit.Module
	// Steps - the module's RegisterSteps (its schema, install, update and
	// demo steps); nil - none.
	Steps func()
	Wire  func(Deps) Parts
	// Catalog - its translations: <lang>.json files at the root of the
	// file system (the module's translations/ directory); nil - none.
	Catalog fs.FS
	// Assets - its templates/ and static/; nil - none.
	Assets fs.FS
}

Registration - a module from outside the engine (its own repository, imported by the site's main package): what the engine's own modules give it too - its description and steps, its Wire, its interface catalogs (translations/) and embedded files (templates/, static/).

func Registered

func Registered() []Registration

Registered - the modules from outside the engine, in the order they registered (the engine lists them after its own).

type Requirement

type Requirement = entity.Requirement

Requirement - one line: what was checked (Title), what was found (Value) and, when not OK, what to do (Description, HTML); translated.

type RequirementSeverity

type RequirementSeverity = entity.RequirementSeverity

RequirementSeverity - how a check came out.

type Role

type Role = entity.Role

Role - a role: its name and permissions.

type Roles

type Roles = entity.Roles

Roles - roles.

type Routes

type Routes struct {
	// Mux - the router, gated by the module's state.
	Mux   Mux
	Store *sessions.CookieStore
	// AdminOnly wraps a handler of the admin: signed in, with the admin
	// permission.
	AdminOnly func(http.Handler) http.Handler
}

Routes - what route registration gives a module.

type SiteInformation

type SiteInformation = entity.SiteInformation

SiteInformation - the site's name, e-mail, language, address.

type SiteInformationRepository

type SiteInformationRepository interface {
	Get(ctx context.Context) (*SiteInformation, error)
	Update(ctx context.Context, s *SiteInformation) error
	// SetLanguages saves the site's languages besides its default one.
	SetLanguages(ctx context.Context, languages []SiteLanguage) error
}

SiteInformationRepository - the site's name, e-mail and languages (Deps.SiteInformation).

type SiteLanguage

type SiteLanguage = entity.SiteLanguage

SiteLanguage - a language of the site besides its default one: its code and its addresses' prefix (SiteInformation.Languages).

func MoveDefaultLanguage

func MoveDefaultLanguage(others []SiteLanguage, oldDef, newDef string) []SiteLanguage

MoveDefaultLanguage - others once newDef becomes the default language instead of oldDef (the old one keeps its addresses under its code).

func SiteLanguages

func SiteLanguages() (string, []SiteLanguage)

SiteLanguages - the site's default language and the others in use.

type StatusCheck

type StatusCheck = service.StatusCheck

StatusCheck - a module's checks: its lines of the status report, in ctx's language.

func CheckWritableDir

func CheckWritableDir(title string, dir func() string) StatusCheck

CheckWritableDir - a check that dir() is a directory the site can write to; title - the directory's name, English, translated with the report (i18n.N).

func CheckWritableStore

func CheckWritableStore(title string, store func() filestore.Store) StatusCheck

CheckWritableStore - a check that the store a module keeps files in (PublicFiles, PrivateFiles) takes a new file; its line shows where the store keeps them.

type TaxonomyService

type TaxonomyService interface {
	Vocabularies(ctx context.Context) (TaxonomyVocabularies, error)
	VocabularyByID(ctx context.Context, id int) (*TaxonomyVocabulary, error)
	TermByID(ctx context.Context, id int) (*TaxonomyTerm, error)
	TermBySlug(ctx context.Context, slug string) (*TaxonomyTerm, error)
	// TermsByIDs - the terms with these ids, by id (a missing one is
	// absent).
	TermsByIDs(ctx context.Context, ids []int) (map[int]TaxonomyTerm, error)
	TermsByVocabularyID(ctx context.Context, vocabularyID int) (TaxonomyTerms, error)
	// NodeTermsByID - a material's terms (its terms index).
	NodeTermsByID(ctx context.Context, nodeID int) (TaxonomyTerms, error)
	// FieldTermIDsForNode - the terms a material's taxonomy fields hold.
	FieldTermIDsForNode(ctx context.Context, nodeID int) ([]int, error)
	// UpdateNodeTerms sets a material's terms index.
	UpdateNodeTerms(ctx context.Context, nodeID int, termIDs []int) error
}

TaxonomyService - the vocabularies and their terms (Deps.Taxonomy).

type TaxonomyTerm

type TaxonomyTerm = entity.TaxonomyTerm

TaxonomyTerm - a term of a vocabulary.

type TaxonomyTerms

type TaxonomyTerms = entity.TaxonomyTerms

TaxonomyTerms - terms.

type TaxonomyVocabularies

type TaxonomyVocabularies = entity.TaxonomyVocabularies

TaxonomyVocabularies - vocabularies.

type TaxonomyVocabulary

type TaxonomyVocabulary = entity.TaxonomyVocabulary

TaxonomyVocabulary - a vocabulary.

type TeaserBuilder

type TeaserBuilder interface {
	// Build returns one card per material, in the same order.
	Build(ctx context.Context, nodes Nodes) ([]TeaserItem, error)
}

TeaserBuilder - the materials' cards (Deps.Teasers).

type TeaserItem

type TeaserItem = entity.TeaserItem

TeaserItem - a material's card (Deps.Teasers).

type TemplateService

type TemplateService = service.TemplateService

TemplateService - the templates (BaseController.TemplateService).

type TextFilter

type TextFilter = service.TextFilter

TextFilter - a module's processing of HTML text when it's shown, turned on per text format (the format page's "Processing when shown"): Name, Module, Label, Description, Apply(ctx, html) - ctx carries the page's language, called on every show, so cheap and without network - and an optional TinyMCE button the formats' editors get (EditorButton, EditorPlugin - the module's script registering it, static/<name>.js).

type UnsavedPreview

type UnsavedPreview = interfaces.UnsavedPreview

UnsavedPreview - the strip over a previewed item's page: the page's data "unsavedPreview".

type UploadResult

type UploadResult = files.UploadResult

UploadResult - what an upload stored: its type, size and dimensions.

type UploadSettings

type UploadSettings = entity.UploadSettings

UploadSettings - the site's upload policy.

type UploadSettingsRepository

type UploadSettingsRepository interface {
	Get(ctx context.Context) (*UploadSettings, error)
}

UploadSettingsRepository - the site's upload policy (Deps.UploadSettings).

type User

type User = entity.User

User - a site user.

func DeletedUser

func DeletedUser() *User

DeletedUser - the author shown for content whose account is gone.

func RequestUser

func RequestUser(r *http.Request) (*User, bool)

RequestUser - the signed-in user the core's access check put in the request with the material (RequestNode: a module's content type pages); elsewhere - UserID after AuthMiddleware, the user - the controller's GetCurrentUser.

type UserContent

type UserContent = service.ModuleUserContent

UserContent - a module's content of a user (Parts.UserContent): Label names its count on the deletion's confirmation (a translation source with @count, "private messages: @count"), Count - how much the user has, Delete - deletes it, before the account.

type UserRepository

type UserRepository interface {
	ByID(ctx context.Context, id int) (*User, error)
	// ByIDs - the users with these ids, by id (a missing one is absent).
	ByIDs(ctx context.Context, ids []int) (map[int]User, error)
}

UserRepository - the users (Deps.Users).

type UserService

type UserService = service.UserService

UserService - the users' service (BaseDeps.Users, BaseController.UserService).

type UserSettingsSection

type UserSettingsSection = interfaces.UserSettingsSection

UserSettingsSection - a module's section of a user's profile form (the user's own settings in the module).

type ViewDisplayDef

type ViewDisplayDef = entity.ViewDisplayDef

ViewDisplayDef - a View's display.

type ViewField

type ViewField = entity.ViewModuleField

ViewField - a value shown in a View's rows: each node's markup (Render), its settings in a View (Params: how it is shown).

type ViewFilter

type ViewFilter = entity.ViewModuleFilter

ViewFilter - a number a View filters by: equal, at least, at most, has one or not.

type ViewOption

type ViewOption = entity.ViewModuleOption

ViewOption - a value of a choice filter (ViewFilter.Options).

type ViewParam

type ViewParam = entity.ViewModuleParam

ViewParam - a setting of a criterion or a field in a View: the kinds of a plugin block's setting (PluginBlockSetting*).

type ViewSort

type ViewSort = entity.ViewModuleSort

ViewSort - a sort criterion: each node's number (Values), its settings in a View (Params: a threshold).

Directories

Path Synopsis
Package demokit - the part of the module SDK a module's demo step uses (app install -demo, docs/modules/write-a-module.md): the step's registration, its texts by language, a block and a menu link of the core's, and the install transaction for the module's own ent client.
Package demokit - the part of the module SDK a module's demo step uses (app install -demo, docs/modules/write-a-module.md): the step's registration, its texts by language, a block and a menu link of the core's, and the install transaction for the module's own ent client.
Package manifestkit - the part of the module SDK (modulekit) a module's manifest and own ent schema use: the module's description and its schema's registration.
Package manifestkit - the part of the module SDK (modulekit) a module's manifest and own ent schema use: the module's description and its schema's registration.
Package schemakit - the engine's conventions for ent schemas, shared by the core's schema and a module's own (its ent/schema): the same table options and column types, so a module's tables look as the core's do.
Package schemakit - the engine's conventions for ent schemas, shared by the core's schema and a module's own (its ent/schema): the same table options and column types, so a module's tables look as the core's do.
Package testkit - the part of the module SDK a module's tests use, as a module from its own repository can:
Package testkit - the part of the module SDK a module's tests use, as a module from its own repository can:

Jump to

Keyboard shortcuts

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