di

package
v0.60.8 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEnvironmentPermissionStrategyRequired = errors.New("di: environment permission strategy resolver required")

ErrEnvironmentPermissionStrategyRequired is returned when a custom permission strategy is configured without a resolver.

View Source
var ErrWorkflowEngineNotProvided = errors.New("di: workflow engine required for custom workflow provider")

ErrWorkflowEngineNotProvided is returned when a custom workflow provider is configured without supplying an engine.

Functions

This section is empty.

Types

type Container

type Container struct {
	Config runtimeconfig.Config
	// contains filtered or unexported fields
}

Container wires module dependencies. Phase 1 only returns no-op services.

func NewContainer

func NewContainer(cfg runtimeconfig.Config, opts ...Option) (*Container, error)

NewContainer creates a container with the provided configuration.

func (*Container) AdminBlockReadService added in v0.45.0

func (c *Container) AdminBlockReadService() interfaces.AdminBlockReadService

AdminBlockReadService returns the configured admin block read service.

func (*Container) AdminBlockWriteService added in v0.45.0

func (c *Container) AdminBlockWriteService() interfaces.AdminBlockWriteService

AdminBlockWriteService returns the configured admin block write service.

func (*Container) AdminContentReadService added in v0.45.0

func (c *Container) AdminContentReadService() interfaces.AdminContentReadService

AdminContentReadService returns the configured admin content read service.

func (*Container) AdminContentWriteService added in v0.45.0

func (c *Container) AdminContentWriteService() interfaces.AdminContentWriteService

AdminContentWriteService returns the configured admin content write service.

func (*Container) AdminPageReadService added in v0.26.0

func (c *Container) AdminPageReadService() interfaces.AdminPageReadService

AdminPageReadService returns the configured admin page read service.

func (*Container) AuditRecorder added in v0.3.0

func (c *Container) AuditRecorder() jobs.AuditRecorder

AuditRecorder returns the audit recorder configured for scheduler instrumentation.

func (*Container) AuthService

func (c *Container) AuthService() interfaces.AuthService

AuthService exposes the configured auth service.

func (*Container) BlockAdminService added in v0.21.0

func (c *Container) BlockAdminService() *adminblocks.Service

BlockAdminService exposes the embedded blocks admin helper.

func (*Container) BlockService

func (c *Container) BlockService() blocks.Service

BlockService returns the configured block service.

func (*Container) ContentRepository

func (c *Container) ContentRepository() content.ContentRepository

ContentRepository exposes the configured content repository.

func (*Container) ContentService

func (c *Container) ContentService() content.Service

ContentService returns the configured content service.

func (*Container) ContentTypeRepository

func (c *Container) ContentTypeRepository() content.ContentTypeRepository

ContentTypeRepository exposes the configured content-type repository.

func (*Container) ContentTypeService added in v0.20.0

func (c *Container) ContentTypeService() content.ContentTypeService

ContentTypeService returns the configured content type service.

func (*Container) EnvironmentRepository added in v0.23.1

func (c *Container) EnvironmentRepository() environments.EnvironmentRepository

EnvironmentRepository exposes the configured environment repository.

func (*Container) EnvironmentService added in v0.23.1

func (c *Container) EnvironmentService() environments.Service

EnvironmentService returns the configured environment service.

func (*Container) GeneratorService

func (c *Container) GeneratorService() generator.Service

GeneratorService returns the configured static site generator service.

func (*Container) I18nService

func (c *Container) I18nService() i18n.Service

I18nService returns the configured i18n service (lazy).

func (*Container) JobWorker added in v0.3.0

func (c *Container) JobWorker() *jobs.Worker

JobWorker returns the worker responsible for replay audit commands.

func (*Container) LocaleRepository

func (c *Container) LocaleRepository() content.LocaleRepository

LocaleRepository exposes the configured locale repository.

func (*Container) LoggerProvider added in v0.3.0

func (c *Container) LoggerProvider() interfaces.LoggerProvider

LoggerProvider returns the logger provider used by the container.

func (*Container) MarkdownService

func (c *Container) MarkdownService() interfaces.MarkdownService

MarkdownService returns the configured markdown service.

func (*Container) MediaProvider

func (c *Container) MediaProvider() interfaces.MediaProvider

MediaProvider exposes the configured media provider.

func (*Container) MediaService

func (c *Container) MediaService() media.Service

MediaService returns the configured media helper service.

func (*Container) MenuService

func (c *Container) MenuService() menus.Service

MenuService returns the configured menu service.

func (*Container) PageRepository

func (c *Container) PageRepository() pages.PageRepository

func (*Container) PageService

func (c *Container) PageService() pages.Service

PageService returns the configured page service.

func (*Container) Scheduler

func (c *Container) Scheduler() interfaces.Scheduler

func (*Container) ShortcodeRegistry added in v0.2.0

func (c *Container) ShortcodeRegistry() interfaces.ShortcodeRegistry

ShortcodeRegistry exposes the shortcode registry when the feature is enabled.

func (*Container) ShortcodeService added in v0.2.0

func (c *Container) ShortcodeService() interfaces.ShortcodeService

ShortcodeService exposes the shortcode rendering service when enabled.

func (*Container) StorageAdminService added in v0.2.0

func (c *Container) StorageAdminService() *adminstorage.Service

StorageAdminService exposes the storage admin helper.

func (*Container) StorageProvider

func (c *Container) StorageProvider() interfaces.StorageProvider

StorageProvider exposes the configured storage implementation.

func (*Container) TemplateRenderer

func (c *Container) TemplateRenderer() interfaces.TemplateRenderer

TemplateRenderer exposes the configured template renderer.

func (*Container) ThemeService

func (c *Container) ThemeService() themes.Service

func (*Container) TranslationAdminService added in v0.16.0

func (c *Container) TranslationAdminService() *admintranslations.Service

TranslationAdminService exposes the translation settings admin helper.

func (*Container) TranslationsEnabled added in v0.2.0

func (c *Container) TranslationsEnabled() bool

TranslationsEnabled reports whether translation handling is globally enabled.

func (*Container) TranslationsRequired added in v0.2.0

func (c *Container) TranslationsRequired() bool

TranslationsRequired reports whether translations must be provided when enabled.

func (*Container) WidgetService

func (c *Container) WidgetService() widgets.Service

WidgetService returns the configured widget service.

func (*Container) WorkflowEngine added in v0.2.0

func (c *Container) WorkflowEngine() interfaces.WorkflowEngine

WorkflowEngine returns the configured workflow engine (may be nil when disabled).

type Option

type Option func(*Container)

Option mutates the container before it is finalised.

func WithActivityHooks added in v0.5.0

func WithActivityHooks(hooks activity.Hooks) Option

WithActivityHooks appends hooks that will receive activity events.

func WithActivitySink added in v0.5.0

func WithActivitySink(sink interfaces.ActivitySink) Option

WithActivitySink overrides the activity sink used for activity emissions.

func WithAuditRecorder

func WithAuditRecorder(recorder jobs.AuditRecorder) Option

WithAuditRecorder overrides the audit recorder used by audit commands and worker instrumentation.

func WithAuth

func WithAuth(ap interfaces.AuthService) Option

WithAuth overrides the default auth provider.

func WithBlockService

func WithBlockService(svc blocks.Service) Option

WithBlockService overrides the default page service binding.

func WithBunDB

func WithBunDB(db *bun.DB) Option

func WithCache

func WithCache(service repocache.CacheService, serializer repocache.KeySerializer) Option

WithCache overrides the default cache provider.

func WithCacheProvider

func WithCacheProvider(provider interfaces.CacheProvider) Option

func WithContentService

func WithContentService(svc content.Service) Option

WithContentService overrides the default content service binding.

func WithContentTypeService added in v0.20.0

func WithContentTypeService(svc content.ContentTypeService) Option

WithContentTypeService overrides the default content type service binding.

func WithEnvironmentPermissionStrategy added in v0.23.1

func WithEnvironmentPermissionStrategy(strategy permissions.Strategy) Option

WithEnvironmentPermissionStrategy overrides the environment permission strategy resolver.

func WithEnvironmentService added in v0.23.1

func WithEnvironmentService(svc environments.Service) Option

WithEnvironmentService overrides the default environment service binding.

func WithGeneratorAssetResolver

func WithGeneratorAssetResolver(resolver generator.AssetResolver) Option

WithGeneratorAssetResolver overrides the asset resolver used during static builds.

func WithGeneratorHooks

func WithGeneratorHooks(hooks generator.Hooks) Option

WithGeneratorHooks registers lifecycle hooks for generator operations.

func WithGeneratorOutput

func WithGeneratorOutput(output string) Option

WithGeneratorOutput overrides the generator output directory.

func WithGeneratorStorage

func WithGeneratorStorage(sp interfaces.StorageProvider) Option

WithGeneratorStorage overrides the storage provider used by the generator.

func WithI18nService

func WithI18nService(svc i18n.Service) Option

WithI18nService overrides the default i18n service binding.

func WithLifecycleHooks added in v0.43.0

func WithLifecycleHooks(hooks lifecycle.Hooks) Option

WithLifecycleHooks appends hooks that will receive root-record lifecycle events.

func WithLoggerProvider

func WithLoggerProvider(provider interfaces.LoggerProvider) Option

WithLoggerProvider overrides the logger provider used to construct command loggers.

func WithMarkdownService

func WithMarkdownService(svc interfaces.MarkdownService) Option

func WithMedia

func WithMedia(mp interfaces.MediaProvider) Option

WithMedia overrides the default media provider.

func WithMenuService

func WithMenuService(svc menus.Service) Option

func WithPageService

func WithPageService(svc pages.Service) Option

WithPageService overrides the default page service binding.

func WithScheduler

func WithScheduler(s interfaces.Scheduler) Option

func WithShortcodeCacheProvider added in v0.2.0

func WithShortcodeCacheProvider(name string, provider interfaces.CacheProvider) Option

WithShortcodeCacheProvider registers a cache provider that can be selected for shortcodes. When name is empty, the provider is used as the default shortcode cache.

func WithShortcodeMetrics added in v0.2.0

func WithShortcodeMetrics(metrics interfaces.ShortcodeMetrics) Option

WithShortcodeMetrics overrides the metrics recorder used by the shortcode service.

func WithSlugNormalizer added in v0.20.0

func WithSlugNormalizer(normalizer slug.Normalizer) Option

WithSlugNormalizer overrides the default slug normalizer used by services.

func WithStorage

func WithStorage(sp interfaces.StorageProvider) Option

WithStorage overrides the default storage provider.

func WithStorageFactory added in v0.2.0

func WithStorageFactory(kind string, factory StorageFactory) Option

WithStorageFactory registers a storage provider factory under the given kind.

func WithStorageRepository added in v0.2.0

func WithStorageRepository(repo storageconfig.Repository) Option

WithStorageRepository overrides the storage profile repository used for runtime configuration.

func WithTemplate

func WithTemplate(tr interfaces.TemplateRenderer) Option

WithTemplate overrides the default template renderer.

func WithThemeService

func WithThemeService(svc themes.Service) Option

func WithTranslationSettingsRepository added in v0.16.0

func WithTranslationSettingsRepository(repo translationconfig.Repository) Option

WithTranslationSettingsRepository overrides the translation settings repository used for runtime configuration.

func WithWidgetService

func WithWidgetService(svc widgets.Service) Option

func WithWorkflowDefinitionStore added in v0.2.0

func WithWorkflowDefinitionStore(store interfaces.WorkflowDefinitionStore) Option

WithWorkflowDefinitionStore registers an external source for workflow definitions.

func WithWorkflowEngine added in v0.2.0

func WithWorkflowEngine(engine interfaces.WorkflowEngine) Option

WithWorkflowEngine overrides the workflow engine used by the module.

type StorageFactory added in v0.2.0

type StorageFactory func(ctx context.Context, profile storage.Profile) (StorageFactoryResult, error)

StorageFactory constructs storage providers and their backing handles for a profile.

type StorageFactoryResult added in v0.2.0

type StorageFactoryResult struct {
	Provider interfaces.StorageProvider
	BunDB    *bun.DB
	Closer   func(context.Context) error
}

StorageFactoryResult captures the outcome of a storage factory invocation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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