services

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigService

type ConfigService struct {
	// contains filtered or unexported fields
}

ConfigService is the service for the config. It implements the ConfigPort interface.

func NewConfigService

func NewConfigService(adapter ports.ConfigPort) *ConfigService

NewConfigService returns a new ConfigService.

func (*ConfigService) LoadConfig

func (s *ConfigService) LoadConfig(filename string) (*entities.Config, error)

LoadConfig loads the config from a file. It returns a LoadConfigError if an error occurs.

type FetchSiteError

type FetchSiteError struct {
	Err error
}

FetchSiteError is returned when the site could not be fetched.

func (FetchSiteError) Error

func (e FetchSiteError) Error() string

Error returns the error message.

type InvalidLanguageError

type InvalidLanguageError struct {
	Language string
}

InvalidLanguageError is returned when the language is invalid.

func (InvalidLanguageError) Error

func (e InvalidLanguageError) Error() string

Error returns the error message.

type LoadConfigError

type LoadConfigError struct {
	Err error
}

LoadConfigError is the error returned by LoadConfig.

func (*LoadConfigError) Error

func (e *LoadConfigError) Error() string

Error returns the error message.

type PageCollectionService

type PageCollectionService struct {
	// contains filtered or unexported fields
}

PageCollectionService is the service for the page collection.

func NewPageCollectionService

func NewPageCollectionService(adapter ports.PageCollectionPort, logger ports.LoggerPort) *PageCollectionService

NewPageCollectionService returns a new PageCollectionService.

func (*PageCollectionService) GetPageCollection

func (s *PageCollectionService) GetPageCollection() *entities.PageCollection

GetPageCollection returns the page collection.

func (*PageCollectionService) Initialize

func (s *PageCollectionService) Initialize(config *entities.Config) error

Initialize initializes the page collection.

func (*PageCollectionService) Subscribe

func (s *PageCollectionService) Subscribe(observer entities.PageCollectionObserver)

Subscribe subscribes an observer to the page collection.

func (*PageCollectionService) Unsubscribe

func (s *PageCollectionService) Unsubscribe(observer *entities.PageCollectionObserver)

Unsubscribe unsubscribes an observer from the page collection.

func (*PageCollectionService) Watch

func (s *PageCollectionService) Watch() error

Watch watches the page collection for changes.

type SiteService

type SiteService struct {
	// contains filtered or unexported fields
}

SiteService is the service for the site.

func NewSiteService

func NewSiteService(siteAdapter ports.SitePort, pageCollectionAdapter ports.PageCollectionPort) *SiteService

NewSiteService creates a new site service.

func (*SiteService) FetchSite

func (s *SiteService) FetchSite(path *url.URL, userLanguage string) (*entities.Site, error)

FetchSite fetches a site based on the path and the user language.

type ThemeService

type ThemeService struct {
	// contains filtered or unexported fields
}

ThemeService is the service for the theme.

func NewThemeService

func NewThemeService(adapter ports.ThemePort) *ThemeService

NewThemeService returns a new ThemeService.

func (*ThemeService) RenderNotFound

func (s *ThemeService) RenderNotFound(site *entities.Site, w io.Writer) error

RenderNotFound renders the 404 page.

func (*ThemeService) RenderPage

func (s *ThemeService) RenderPage(site *entities.Site, w io.Writer) error

RenderPage renders a page with the site data.

func (*ThemeService) WatchTemplates

func (a *ThemeService) WatchTemplates()

WatchTemplates watches the theme templates for changes.

Jump to

Keyboard shortcuts

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