article

package
v0.0.0-...-9f87b0a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArticleRepository

type ArticleRepository interface {
	Fetch(ctx context.Context, cursor string, num int64) (res []domain.Article, nextCursor string, err error)
	GetByID(ctx context.Context, id int64) (domain.Article, error)
	GetByTitle(ctx context.Context, title string) (domain.Article, error)
	Update(ctx context.Context, ar *domain.Article) error
	Store(ctx context.Context, a *domain.Article) error
	Delete(ctx context.Context, id int64) error
}

ArticleRepository represent the article's repository contract

type AuthorRepository

type AuthorRepository interface {
	GetByID(ctx context.Context, id int64) (domain.Author, error)
}

AuthorRepository represent the author's repository contract

type Service

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

func NewService

func NewService(a ArticleRepository, ar AuthorRepository) *Service

NewService will create a new article service object

func (*Service) Delete

func (a *Service) Delete(ctx context.Context, id int64) (err error)

func (*Service) Fetch

func (a *Service) Fetch(ctx context.Context, cursor string, num int64) (res []domain.Article, nextCursor string, err error)

func (*Service) GetByID

func (a *Service) GetByID(ctx context.Context, id int64) (res domain.Article, err error)

func (*Service) GetByTitle

func (a *Service) GetByTitle(ctx context.Context, title string) (res domain.Article, err error)

func (*Service) Store

func (a *Service) Store(ctx context.Context, m *domain.Article) (err error)

func (*Service) Update

func (a *Service) Update(ctx context.Context, ar *domain.Article) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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