Documentation
¶
Index ¶
- Variables
- func NewAdminPageDBReadService(db *bun.DB, pageSvc Service, contentSvc content.Service, ...) interfaces.AdminPageReadService
- func NewAdminPageReadService(pageSvc Service, contentSvc content.Service, locales content.LocaleRepository, ...) interfaces.AdminPageReadService
- func NewPageRepository(db *bun.DB) repository.Repository[*Page]
- func NewPageTranslationRepository(db *bun.DB) repository.Repository[*PageTranslation]
- func NewPageVersionRepository(db *bun.DB) repository.Repository[*PageVersion]
- type AdminPageReadOption
- type BunPageRepository
- func (r *BunPageRepository) Create(ctx context.Context, record *Page) (*Page, error)
- func (r *BunPageRepository) CreateVersion(ctx context.Context, version *PageVersion) (*PageVersion, error)
- func (r *BunPageRepository) Delete(ctx context.Context, id uuid.UUID, hardDelete bool) error
- func (r *BunPageRepository) GetByID(ctx context.Context, id uuid.UUID) (*Page, error)
- func (r *BunPageRepository) GetBySlug(ctx context.Context, slug string, env ...string) (*Page, error)
- func (r *BunPageRepository) GetLatestVersion(ctx context.Context, pageID uuid.UUID) (*PageVersion, error)
- func (r *BunPageRepository) GetVersion(ctx context.Context, pageID uuid.UUID, number int) (*PageVersion, error)
- func (r *BunPageRepository) List(ctx context.Context, env ...string) ([]*Page, error)
- func (r *BunPageRepository) ListTranslations(ctx context.Context, pageID uuid.UUID) ([]*PageTranslation, error)
- func (r *BunPageRepository) ListVersions(ctx context.Context, pageID uuid.UUID) ([]*PageVersion, error)
- func (r *BunPageRepository) ReplaceTranslations(ctx context.Context, pageID uuid.UUID, translations []*PageTranslation) error
- func (r *BunPageRepository) Update(ctx context.Context, record *Page) (*Page, error)
- func (r *BunPageRepository) UpdateVersion(ctx context.Context, version *PageVersion) (*PageVersion, error)
- type ContentRepository
- type CreatePageDraftRequest
- type CreatePageRequest
- type DeletePageRequest
- type DeletePageTranslationRequest
- type DuplicatePageRequest
- type IDGenerator
- type InvalidLocaleError
- type LocaleRepository
- type MemoryPageRepository
- func (m *MemoryPageRepository) Create(_ context.Context, record *Page) (*Page, error)
- func (m *MemoryPageRepository) CreateVersion(_ context.Context, version *PageVersion) (*PageVersion, error)
- func (m *MemoryPageRepository) Delete(_ context.Context, id uuid.UUID, hardDelete bool) error
- func (m *MemoryPageRepository) GetByID(_ context.Context, id uuid.UUID) (*Page, error)
- func (m *MemoryPageRepository) GetBySlug(_ context.Context, slug string, env ...string) (*Page, error)
- func (m *MemoryPageRepository) GetLatestVersion(_ context.Context, pageID uuid.UUID) (*PageVersion, error)
- func (m *MemoryPageRepository) GetVersion(_ context.Context, pageID uuid.UUID, number int) (*PageVersion, error)
- func (m *MemoryPageRepository) List(_ context.Context, env ...string) ([]*Page, error)
- func (m *MemoryPageRepository) ListTranslations(_ context.Context, pageID uuid.UUID) ([]*PageTranslation, error)
- func (m *MemoryPageRepository) ListVersions(_ context.Context, pageID uuid.UUID) ([]*PageVersion, error)
- func (m *MemoryPageRepository) ReplaceTranslations(_ context.Context, pageID uuid.UUID, translations []*PageTranslation) error
- func (m *MemoryPageRepository) Update(_ context.Context, record *Page) (*Page, error)
- func (m *MemoryPageRepository) UpdateVersion(_ context.Context, version *PageVersion) (*PageVersion, error)
- type MovePageRequest
- type Page
- type PageBlockPlacement
- type PageNotFoundError
- type PagePreview
- type PageRepository
- type PageTranslation
- type PageTranslationInput
- type PageTranslationReader
- type PageVersion
- type PageVersionNotFoundError
- type PageVersionSnapshot
- type PathConflictError
- type PreviewPageDraftRequest
- type PublishPageDraftRequest
- type PublishPagePublishRequest
- type RestorePageVersionRequest
- type SchedulePageRequest
- type Service
- type ServiceOption
- func WithActivityEmitter(emitter *activity.Emitter) ServiceOption
- func WithBlockService(service blocks.Service) ServiceOption
- func WithDefaultEnvironmentKey(key string) ServiceOption
- func WithDefaultLocale(locale string, required bool) ServiceOption
- func WithEmbeddedBlockBridge(bridge *blocks.EmbeddedBlockBridge) ServiceOption
- func WithEnvironmentService(service cmsenv.Service) ServiceOption
- func WithIDGenerator(generator IDGenerator) ServiceOption
- func WithLifecycleEmitter(emitter *lifecycle.Emitter) ServiceOption
- func WithLogger(logger interfaces.Logger) ServiceOption
- func WithMediaService(svc media.Service) ServiceOption
- func WithPageClock(clock func() time.Time) ServiceOption
- func WithPageVersionRetentionLimit(limit int) ServiceOption
- func WithPageVersioningEnabled(enabled bool) ServiceOption
- func WithRequireActiveEnvironment(required bool) ServiceOption
- func WithRequireExplicitEnvironment(required bool) ServiceOption
- func WithRequireTranslations(required bool) ServiceOption
- func WithScheduler(scheduler interfaces.Scheduler) ServiceOption
- func WithSchedulingEnabled(enabled bool) ServiceOption
- func WithThemeService(svc themes.Service) ServiceOption
- func WithTranslationState(state *translationconfig.State) ServiceOption
- func WithTranslationsEnabled(enabled bool) ServiceOption
- func WithWidgetService(svc widgets.Service) ServiceOption
- func WithWorkflowEngine(engine interfaces.WorkflowEngine) ServiceOption
- type SourceNotFoundError
- type TranslationAlreadyExistsError
- type TranslationCheckOptions
- type TranslationInvariantViolationError
- type UpdatePageRequest
- type UpdatePageTranslationRequest
- type WidgetPlacementSnapshot
Constants ¶
This section is empty.
Variables ¶
var ( ErrContentRequired = cmspages.ErrContentRequired ErrTemplateRequired = cmspages.ErrTemplateRequired ErrSlugRequired = cmspages.ErrSlugRequired ErrSlugInvalid = cmspages.ErrSlugInvalid ErrSlugExists = cmspages.ErrSlugExists ErrPathExists = cmspages.ErrPathExists ErrPathConflict = cmspages.ErrPathConflict ErrUnknownLocale = cmspages.ErrUnknownLocale ErrInvalidLocale = cmspages.ErrInvalidLocale ErrSourceNotFound = cmspages.ErrSourceNotFound ErrTranslationAlreadyExists = cmspages.ErrTranslationAlreadyExists ErrTranslationInvariantViolation = cmspages.ErrTranslationInvariantViolation ErrDuplicateLocale = cmspages.ErrDuplicateLocale ErrParentNotFound = cmspages.ErrParentNotFound ErrNoPageTranslations = cmspages.ErrNoPageTranslations ErrDefaultLocaleRequired = cmspages.ErrDefaultLocaleRequired ErrTemplateUnknown = cmspages.ErrTemplateUnknown ErrPageRequired = cmspages.ErrPageRequired ErrVersioningDisabled = cmspages.ErrVersioningDisabled ErrPageVersionRequired = cmspages.ErrPageVersionRequired ErrVersionAlreadyPublished = cmspages.ErrVersionAlreadyPublished ErrVersionRetentionExceeded = cmspages.ErrVersionRetentionExceeded ErrVersionConflict = cmspages.ErrVersionConflict ErrSchedulingDisabled = cmspages.ErrSchedulingDisabled ErrScheduleWindowInvalid = cmspages.ErrScheduleWindowInvalid ErrScheduleTimestampInvalid = cmspages.ErrScheduleTimestampInvalid ErrPageMediaReferenceRequired = cmspages.ErrPageMediaReferenceRequired ErrPageSoftDeleteUnsupported = cmspages.ErrPageSoftDeleteUnsupported ErrPageTranslationsDisabled = cmspages.ErrPageTranslationsDisabled ErrPageTranslationNotFound = cmspages.ErrPageTranslationNotFound ErrPageParentCycle = cmspages.ErrPageParentCycle ErrPageDuplicateSlug = cmspages.ErrPageDuplicateSlug )
var PageVersionSnapshotSchema = cmspages.PageVersionSnapshotSchema
Functions ¶
func NewAdminPageDBReadService ¶ added in v0.26.0
func NewAdminPageDBReadService(db *bun.DB, pageSvc Service, contentSvc content.Service, locales content.LocaleRepository, opts ...AdminPageReadOption) interfaces.AdminPageReadService
NewAdminPageDBReadService constructs a DB-backed admin page read service.
func NewAdminPageReadService ¶ added in v0.26.0
func NewAdminPageReadService(pageSvc Service, contentSvc content.Service, locales content.LocaleRepository, opts ...AdminPageReadOption) interfaces.AdminPageReadService
NewAdminPageReadService constructs the default admin read service.
func NewPageRepository ¶
func NewPageRepository(db *bun.DB) repository.Repository[*Page]
func NewPageTranslationRepository ¶
func NewPageTranslationRepository(db *bun.DB) repository.Repository[*PageTranslation]
func NewPageVersionRepository ¶
func NewPageVersionRepository(db *bun.DB) repository.Repository[*PageVersion]
Types ¶
type AdminPageReadOption ¶ added in v0.26.0
type AdminPageReadOption func(*adminPageReadService)
AdminPageReadOption configures the admin read service.
func WithAdminPageReadLogger ¶ added in v0.26.0
func WithAdminPageReadLogger(logger interfaces.Logger) AdminPageReadOption
WithAdminPageReadLogger overrides the logger used by the admin read service.
type BunPageRepository ¶
type BunPageRepository struct {
// contains filtered or unexported fields
}
func NewBunPageRepository ¶
func NewBunPageRepository(db *bun.DB) *BunPageRepository
func NewBunPageRepositoryWithCache ¶
func NewBunPageRepositoryWithCache(db *bun.DB, cacheService cache.CacheService, keySerializer cache.KeySerializer) *BunPageRepository
NewBunPageRepositoryWithCache constructs a PageRepository backed by bun with optional caching.
func (*BunPageRepository) CreateVersion ¶
func (r *BunPageRepository) CreateVersion(ctx context.Context, version *PageVersion) (*PageVersion, error)
func (*BunPageRepository) GetLatestVersion ¶
func (r *BunPageRepository) GetLatestVersion(ctx context.Context, pageID uuid.UUID) (*PageVersion, error)
func (*BunPageRepository) GetVersion ¶
func (r *BunPageRepository) GetVersion(ctx context.Context, pageID uuid.UUID, number int) (*PageVersion, error)
func (*BunPageRepository) ListTranslations ¶ added in v0.30.0
func (r *BunPageRepository) ListTranslations(ctx context.Context, pageID uuid.UUID) ([]*PageTranslation, error)
ListTranslations returns translations for a page record.
func (*BunPageRepository) ListVersions ¶
func (r *BunPageRepository) ListVersions(ctx context.Context, pageID uuid.UUID) ([]*PageVersion, error)
func (*BunPageRepository) ReplaceTranslations ¶
func (r *BunPageRepository) ReplaceTranslations(ctx context.Context, pageID uuid.UUID, translations []*PageTranslation) error
func (*BunPageRepository) UpdateVersion ¶
func (r *BunPageRepository) UpdateVersion(ctx context.Context, version *PageVersion) (*PageVersion, error)
type ContentRepository ¶
type ContentRepository interface {
GetByID(ctx context.Context, id uuid.UUID) (*content.Content, error)
}
ContentRepository allows lookups for existing content.
type CreatePageDraftRequest ¶
type CreatePageDraftRequest = cmspages.CreatePageDraftRequest
type CreatePageRequest ¶
type CreatePageRequest = cmspages.CreatePageRequest
type DeletePageRequest ¶
type DeletePageRequest = cmspages.DeletePageRequest
type DeletePageTranslationRequest ¶ added in v0.2.0
type DeletePageTranslationRequest = cmspages.DeletePageTranslationRequest
type DuplicatePageRequest ¶ added in v0.2.0
type DuplicatePageRequest = cmspages.DuplicatePageRequest
type IDGenerator ¶
IDGenerator5 produces unique identifier for page entiteis
type InvalidLocaleError ¶ added in v0.36.0
type InvalidLocaleError = cmspages.InvalidLocaleError
type LocaleRepository ¶
type LocaleRepository interface {
GetByCode(ctx context.Context, code string) (*content.Locale, error)
GetByID(ctx context.Context, id uuid.UUID) (*content.Locale, error)
}
LocaleRepository resolves locales.
type MemoryPageRepository ¶
type MemoryPageRepository struct {
// contains filtered or unexported fields
}
MemoryPageRepository is an in-memory page store for scaffolding/tests.
func NewMemoryPageRepository ¶
func NewMemoryPageRepository() *MemoryPageRepository
NewMemoryPageRepository constructs the repository.
func (*MemoryPageRepository) CreateVersion ¶
func (m *MemoryPageRepository) CreateVersion(_ context.Context, version *PageVersion) (*PageVersion, error)
CreateVersion appends a version to the supplied page.
func (*MemoryPageRepository) Delete ¶
Delete removes the page and associated versions when hard delete is requested.
func (*MemoryPageRepository) GetBySlug ¶
func (m *MemoryPageRepository) GetBySlug(_ context.Context, slug string, env ...string) (*Page, error)
GetBySlug retrieves a page by slug.
func (*MemoryPageRepository) GetLatestVersion ¶
func (m *MemoryPageRepository) GetLatestVersion(_ context.Context, pageID uuid.UUID) (*PageVersion, error)
GetLatestVersion retrieves the most recent version of a page.
func (*MemoryPageRepository) GetVersion ¶
func (m *MemoryPageRepository) GetVersion(_ context.Context, pageID uuid.UUID, number int) (*PageVersion, error)
GetVersion retrieves a specific version number for a page.
func (*MemoryPageRepository) ListTranslations ¶ added in v0.30.0
func (m *MemoryPageRepository) ListTranslations(_ context.Context, pageID uuid.UUID) ([]*PageTranslation, error)
ListTranslations returns stored translations for a page.
func (*MemoryPageRepository) ListVersions ¶
func (m *MemoryPageRepository) ListVersions(_ context.Context, pageID uuid.UUID) ([]*PageVersion, error)
ListVersions returns all recorded versions for a page.
func (*MemoryPageRepository) ReplaceTranslations ¶
func (m *MemoryPageRepository) ReplaceTranslations(_ context.Context, pageID uuid.UUID, translations []*PageTranslation) error
ReplaceTranslations swaps the translations associated with a page.
func (*MemoryPageRepository) UpdateVersion ¶
func (m *MemoryPageRepository) UpdateVersion(_ context.Context, version *PageVersion) (*PageVersion, error)
UpdateVersion mutates stored metadata for a page version.
type MovePageRequest ¶ added in v0.2.0
type MovePageRequest = cmspages.MovePageRequest
type PageBlockPlacement ¶
type PageBlockPlacement = cmspages.PageBlockPlacement
type PageNotFoundError ¶
type PageNotFoundError struct {
Key string
}
PageNotFoundError indicates missing page records.
func (*PageNotFoundError) Error ¶
func (e *PageNotFoundError) Error() string
type PagePreview ¶ added in v0.21.0
type PagePreview = cmspages.PagePreview
type PageRepository ¶
type PageRepository interface {
Create(ctx context.Context, record *Page) (*Page, error)
GetByID(ctx context.Context, id uuid.UUID) (*Page, error)
GetBySlug(ctx context.Context, slug string, env ...string) (*Page, error)
List(ctx context.Context, env ...string) ([]*Page, error)
Update(ctx context.Context, record *Page) (*Page, error)
ReplaceTranslations(ctx context.Context, pageID uuid.UUID, translations []*PageTranslation) error
Delete(ctx context.Context, id uuid.UUID, hardDelete bool) error
CreateVersion(ctx context.Context, version *PageVersion) (*PageVersion, error)
ListVersions(ctx context.Context, pageID uuid.UUID) ([]*PageVersion, error)
GetVersion(ctx context.Context, pageID uuid.UUID, number int) (*PageVersion, error)
GetLatestVersion(ctx context.Context, pageID uuid.UUID) (*PageVersion, error)
UpdateVersion(ctx context.Context, version *PageVersion) (*PageVersion, error)
}
PageRepository abstracts storage operations for pages.
type PageTranslation ¶
type PageTranslation = cmspages.PageTranslation
type PageTranslationInput ¶
type PageTranslationInput = cmspages.PageTranslationInput
type PageTranslationReader ¶ added in v0.30.0
type PageTranslationReader interface {
ListTranslations(ctx context.Context, pageID uuid.UUID) ([]*PageTranslation, error)
}
PageTranslationReader exposes translation lookups when page records omit translations.
type PageVersion ¶
type PageVersion = cmspages.PageVersion
type PageVersionNotFoundError ¶
func (*PageVersionNotFoundError) Error ¶
func (e *PageVersionNotFoundError) Error() string
type PageVersionSnapshot ¶
type PageVersionSnapshot = cmspages.PageVersionSnapshot
type PathConflictError ¶ added in v0.36.0
type PathConflictError = cmspages.PathConflictError
type PreviewPageDraftRequest ¶ added in v0.21.0
type PreviewPageDraftRequest = cmspages.PreviewPageDraftRequest
type PublishPageDraftRequest ¶ added in v0.33.0
type PublishPageDraftRequest = cmspages.PublishPageDraftRequest
type PublishPagePublishRequest ¶
type PublishPagePublishRequest = cmspages.PublishPageDraftRequest
type RestorePageVersionRequest ¶
type RestorePageVersionRequest = cmspages.RestorePageVersionRequest
type SchedulePageRequest ¶
type SchedulePageRequest = cmspages.SchedulePageRequest
type Service ¶
func NewService ¶
func NewService(pages PageRepository, contentRepo ContentRepository, locales LocaleRepository, opts ...ServiceOption) Service
NewService constructs a page service with the required dependencies.
type ServiceOption ¶
type ServiceOption func(*pageService)
ServiceOption mutates the service configuration.
func WithActivityEmitter ¶ added in v0.5.0
func WithActivityEmitter(emitter *activity.Emitter) ServiceOption
WithActivityEmitter wires the activity emitter used for activity records.
func WithBlockService ¶
func WithBlockService(service blocks.Service) ServiceOption
func WithDefaultEnvironmentKey ¶ added in v0.23.1
func WithDefaultEnvironmentKey(key string) ServiceOption
WithDefaultEnvironmentKey overrides the default environment key.
func WithDefaultLocale ¶ added in v0.20.0
func WithDefaultLocale(locale string, required bool) ServiceOption
WithDefaultLocale sets the locale required for default fallback handling.
func WithEmbeddedBlockBridge ¶ added in v0.21.0
func WithEmbeddedBlockBridge(bridge *blocks.EmbeddedBlockBridge) ServiceOption
WithEmbeddedBlockBridge wires an embedded block bridge for read-path fallback.
func WithEnvironmentService ¶ added in v0.23.1
func WithEnvironmentService(service cmsenv.Service) ServiceOption
WithEnvironmentService wires the environment service for env resolution.
func WithIDGenerator ¶
func WithIDGenerator(generator IDGenerator) ServiceOption
func WithLifecycleEmitter ¶ added in v0.43.0
func WithLifecycleEmitter(emitter *lifecycle.Emitter) ServiceOption
WithLifecycleEmitter wires the lifecycle emitter used for root-record lifecycle events.
func WithLogger ¶
func WithLogger(logger interfaces.Logger) ServiceOption
func WithMediaService ¶
func WithMediaService(svc media.Service) ServiceOption
func WithPageClock ¶
func WithPageClock(clock func() time.Time) ServiceOption
WithPageClock overrides the internal clock.
func WithPageVersionRetentionLimit ¶
func WithPageVersionRetentionLimit(limit int) ServiceOption
WithPageVersionRetentionLimit constrains how many versions are retained per page.
func WithPageVersioningEnabled ¶
func WithPageVersioningEnabled(enabled bool) ServiceOption
WithPageVersioningEnabled toggles versioning specific capabilities.
func WithRequireActiveEnvironment ¶ added in v0.23.1
func WithRequireActiveEnvironment(required bool) ServiceOption
WithRequireActiveEnvironment blocks operations on inactive environments.
func WithRequireExplicitEnvironment ¶ added in v0.23.1
func WithRequireExplicitEnvironment(required bool) ServiceOption
WithRequireExplicitEnvironment enforces explicit environment selection.
func WithRequireTranslations ¶ added in v0.2.0
func WithRequireTranslations(required bool) ServiceOption
WithRequireTranslations controls whether the service enforces translation presence.
func WithScheduler ¶
func WithScheduler(scheduler interfaces.Scheduler) ServiceOption
WithScheduler wires the scheduler used to enqueue publish/unpublish jobs.
func WithSchedulingEnabled ¶
func WithSchedulingEnabled(enabled bool) ServiceOption
WithSchedulingEnabled toggles scheduling workflows.
func WithThemeService ¶
func WithThemeService(svc themes.Service) ServiceOption
func WithTranslationState ¶ added in v0.16.0
func WithTranslationState(state *translationconfig.State) ServiceOption
WithTranslationState wires a shared, runtime-configurable translation state.
func WithTranslationsEnabled ¶ added in v0.2.0
func WithTranslationsEnabled(enabled bool) ServiceOption
WithTranslationsEnabled toggles translation handling entirely.
func WithWidgetService ¶
func WithWidgetService(svc widgets.Service) ServiceOption
func WithWorkflowEngine ¶ added in v0.2.0
func WithWorkflowEngine(engine interfaces.WorkflowEngine) ServiceOption
WithWorkflowEngine wires the workflow engine responsible for state transitions.
type SourceNotFoundError ¶ added in v0.36.0
type SourceNotFoundError = cmspages.SourceNotFoundError
type TranslationAlreadyExistsError ¶ added in v0.36.0
type TranslationAlreadyExistsError = cmspages.TranslationAlreadyExistsError
type TranslationCheckOptions ¶ added in v0.33.0
type TranslationCheckOptions = cmspages.TranslationCheckOptions
type TranslationInvariantViolationError ¶ added in v0.36.0
type TranslationInvariantViolationError = cmspages.TranslationInvariantViolationError
type UpdatePageRequest ¶
type UpdatePageRequest = cmspages.UpdatePageRequest
type UpdatePageTranslationRequest ¶ added in v0.2.0
type UpdatePageTranslationRequest = cmspages.UpdatePageTranslationRequest
type WidgetPlacementSnapshot ¶
type WidgetPlacementSnapshot = cmspages.WidgetPlacementSnapshot