kit/pkg/link/link_service.go

37 lines
684 B
Go
Raw Normal View History

2023-10-25 08:49:59 +00:00
package link
type Service struct {
repo Repository
}
// NewLinkUsecase returns a service to manipulate Link
func NewLinkUsecase(r Repository) *Service {
return &Service{repo: r}
}
func (l *Service) Delete(id int64) error {
return l.repo.Delete(id)
}
func (l *Service) GetAll() ([]*Model, error) {
return l.repo.GetAll()
}
func (l *Service) GetByID(id int64) (*Model, error) {
link, err := l.repo.GetByID(id)
return link, err
}
func (l *Service) GetByHash(hash string) (*Model, error) {
return l.repo.GetByHash(hash)
}
func (l *Service) Store(link *Model) error {
return l.repo.Store(link)
}
func (l *Service) Update(link *Model) error {
return l.repo.Update(link)
}