porter_app_event.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package test
  2. import (
  3. "context"
  4. "errors"
  5. "github.com/google/uuid"
  6. "github.com/porter-dev/porter/internal/models"
  7. "github.com/porter-dev/porter/internal/repository"
  8. "github.com/porter-dev/porter/internal/repository/gorm/helpers"
  9. )
  10. type PorterAppEventRepository struct {
  11. canQuery bool
  12. }
  13. func NewPorterAppEventRepository(canQuery bool, failingMethods ...string) repository.PorterAppEventRepository {
  14. return &PorterAppEventRepository{canQuery: false}
  15. }
  16. func (repo *PorterAppEventRepository) ListEventsByPorterAppID(ctx context.Context, porterAppID uint, opts ...helpers.QueryOption) ([]*models.PorterAppEvent, helpers.PaginatedResult, error) {
  17. return nil, helpers.PaginatedResult{}, errors.New("cannot write database")
  18. }
  19. // ListEventsByPorterAppIDAndDeploymentTargetID is a test method
  20. func (repo *PorterAppEventRepository) ListEventsByPorterAppIDAndDeploymentTargetID(ctx context.Context, porterAppID uint, deploymentTargetID uuid.UUID, opts ...helpers.QueryOption) ([]*models.PorterAppEvent, helpers.PaginatedResult, error) {
  21. return nil, helpers.PaginatedResult{}, errors.New("cannot write database")
  22. }
  23. func (repo *PorterAppEventRepository) CreateEvent(ctx context.Context, appEvent *models.PorterAppEvent) error {
  24. return errors.New("cannot write database")
  25. }
  26. func (repo *PorterAppEventRepository) UpdateEvent(ctx context.Context, appEvent *models.PorterAppEvent) error {
  27. return errors.New("cannot update database")
  28. }
  29. func (repo *PorterAppEventRepository) ReadEvent(ctx context.Context, id uuid.UUID) (models.PorterAppEvent, error) {
  30. return models.PorterAppEvent{}, errors.New("cannot read database")
  31. }
  32. func (repo *PorterAppEventRepository) ReadDeployEventByRevision(ctx context.Context, porterAppID uint, revision float64) (models.PorterAppEvent, error) {
  33. return models.PorterAppEvent{}, errors.New("cannot read database")
  34. }
  35. // ReadDeployEventByAppRevisionID is a test method
  36. func (repo *PorterAppEventRepository) ReadDeployEventByAppRevisionID(ctx context.Context, porterAppID uint, appRevisionID string) (models.PorterAppEvent, error) {
  37. return models.PorterAppEvent{}, errors.New("cannot read database")
  38. }