Documentation ¶
Index ¶
- Variables
- type CreateArticleInput
- type CreateSubscriberInput
- type FetchArticlesInput
- type FetchSubscribersInput
- type Service
- func (svc Service) CreateArticle(input *CreateArticleInput) (*models.Article, error)
- func (svc Service) CreateSubscriber(input *CreateSubscriberInput) (*models.Subscriber, error)
- func (svc *Service) DeleteArticle(id string) error
- func (svc Service) DeleteSubscriber(id string) error
- func (svc *Service) GetArticleByID(id string) (*models.Article, error)
- func (svc *Service) GetArticles(input *FetchArticlesInput) ([]models.Article, error)
- func (svc Service) GetSubscribers(input *FetchSubscribersInput) ([]models.Subscriber, error)
- func (svc *Service) UpdateArticle(id string, input *UpdateArticleInput) (*models.Article, error)
- type UpdateArticleInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFailedValidation = errors.New("failed validation") ErrNotFound = errors.New("document not found") )
Functions ¶
This section is empty.
Types ¶
type CreateArticleInput ¶
type CreateSubscriberInput ¶
type FetchArticlesInput ¶
type FetchSubscribersInput ¶
type Service ¶
type Service struct {
Repo *data.Repository
}
func New ¶
func New(r *data.Repository) *Service
func (Service) CreateArticle ¶
func (svc Service) CreateArticle(input *CreateArticleInput) (*models.Article, error)
func (Service) CreateSubscriber ¶
func (svc Service) CreateSubscriber(input *CreateSubscriberInput) (*models.Subscriber, error)
func (*Service) DeleteArticle ¶
func (Service) DeleteSubscriber ¶
func (*Service) GetArticleByID ¶
func (*Service) GetArticles ¶
func (svc *Service) GetArticles(input *FetchArticlesInput) ([]models.Article, error)
func (Service) GetSubscribers ¶
func (svc Service) GetSubscribers(input *FetchSubscribersInput) ([]models.Subscriber, error)
func (*Service) UpdateArticle ¶
type UpdateArticleInput ¶
type UpdateArticleInput struct { Title string `bson:"title,omitempty" json:"title,omitempty"` Content string `bson:"content,omitempty" json:"content,omitempty"` Tags []string `bson:"tags,omitempty" json:"tags,omitempty"` Author string `bson:"author,omitempty" json:"author,omitempty"` Status string `bson:"status,omitempty" json:"status,omitempty"` ValidationErrors map[string]string `bson:"-" json:"-"` }
Click to show internal directories.
Click to hide internal directories.