home/internal/static/repository/stub/stub_static.go

35 lines
774 B
Go

package stub
import (
"context"
"source.toby3d.me/toby3d/home/internal/domain"
"source.toby3d.me/toby3d/home/internal/static"
)
type stubStaticRepository struct {
static *domain.Static
error error
status bool
}
func (repo *stubStaticRepository) Create(_ context.Context, _ domain.Static, _ string) (bool, error) {
return repo.status, repo.error
}
func (repo *stubStaticRepository) Delete(_ context.Context, _ string) (bool, error) {
return repo.status, repo.error
}
func (repo *stubStaticRepository) Get(_ context.Context, _ string) (*domain.Static, error) {
return repo.static, repo.error
}
func NewStubStaticRepository(err error, s *domain.Static, ok bool) static.Repository {
return &stubStaticRepository{
static: s,
error: err,
status: ok,
}
}