Documentation
¶
Index ¶
- type ArticleService
- func (svc *ArticleService) ApplyArticleChanges(id string, changes *model.UpdateArticle) (*model.Article, error)
- func (svc *ArticleService) CreateArticleFromRequest(creationRequest *model.CreateArticle) (*model.Article, error)
- func (svc *ArticleService) DeleteArticle(id string) (bool, error)
- func (svc *ArticleService) GetArticle(id string) (*model.Article, error)
- func (svc *ArticleService) ListArticles() ([]*model.Article, error)
- func (svc *ArticleService) SaveArticle(article *model.Article) (*model.Article, error)
- func (svc *ArticleService) SubscribeArticleCreation() *ArticleServiceObserver
- func (svc *ArticleService) UnsubscribeArticleCreation(observer *ArticleServiceObserver)
- type ArticleServiceObserver
- type IArticleService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticleService ¶
type ArticleService struct {
// contains filtered or unexported fields
}
func NewArticleService ¶
func NewArticleService(repo repository.IArticleRepository) *ArticleService
func (*ArticleService) ApplyArticleChanges ¶
func (svc *ArticleService) ApplyArticleChanges(id string, changes *model.UpdateArticle) (*model.Article, error)
Applies a UpdateArticle-Request to an Article by its IDs and stores the updated Article back to the database.
func (*ArticleService) CreateArticleFromRequest ¶
func (svc *ArticleService) CreateArticleFromRequest(creationRequest *model.CreateArticle) (*model.Article, error)
Creates a new Article from an CreateArticle-Request
func (*ArticleService) DeleteArticle ¶
func (svc *ArticleService) DeleteArticle(id string) (bool, error)
Delete an Article by its ID. Returning (true, nil) when the deletion was successful.
func (*ArticleService) GetArticle ¶
func (svc *ArticleService) GetArticle(id string) (*model.Article, error)
Returns an Article from the Database by its ID.
func (*ArticleService) ListArticles ¶
func (svc *ArticleService) ListArticles() ([]*model.Article, error)
Returns a List of all Articles found in the Database.
func (*ArticleService) SaveArticle ¶
Saves an Article to the Database. If the Article does not already exists, it will be created.
func (*ArticleService) SubscribeArticleCreation ¶
func (svc *ArticleService) SubscribeArticleCreation() *ArticleServiceObserver
Adds an Observer to the ArticleCreationStream. The returned object is holding a personal channel
func (*ArticleService) UnsubscribeArticleCreation ¶
func (svc *ArticleService) UnsubscribeArticleCreation(observer *ArticleServiceObserver)
Remove an Observer from the ArticleCreationStream
type ArticleServiceObserver ¶
type IArticleService ¶
type IArticleService interface {
ListArticles() ([]*model.Article, error)
GetArticle(string) (*model.Article, error)
SaveArticle(*model.Article) (*model.Article, error)
DeleteArticle(string) (bool, error)
CreateArticleFromRequest(*model.CreateArticle) (*model.Article, error)
ApplyArticleChanges(string, *model.UpdateArticle) (*model.Article, error)
SubscribeArticleCreation() *ArticleServiceObserver
UnsubscribeArticleCreation(*ArticleServiceObserver)
}
Click to show internal directories.
Click to hide internal directories.