kit/pkg/link/link_service.go

37 lines
684 B
Go

package link
type Service struct {
repo Repository
}
// NewLinkUsecase returns a service to manipulate Link
func NewLinkService(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)
}