interfaces.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package publish
  2. import (
  3. "context"
  4. "time"
  5. "github.com/qor/oss"
  6. "gorm.io/gorm"
  7. )
  8. type PublishAction struct {
  9. Url string
  10. Content string
  11. IsDelete bool
  12. }
  13. type PublishInterface interface {
  14. GetPublishActions(db *gorm.DB, ctx context.Context, storage oss.StorageInterface) (actions []*PublishAction, err error)
  15. }
  16. type UnPublishInterface interface {
  17. GetUnPublishActions(db *gorm.DB, ctx context.Context, storage oss.StorageInterface) (actions []*PublishAction, err error)
  18. }
  19. type AfterPublishInterface interface {
  20. AfterPublish(db *gorm.DB, storage oss.StorageInterface, ctx context.Context) error
  21. }
  22. type AfterUnPublishInterface interface {
  23. AfterUnPublish(db *gorm.DB, storage oss.StorageInterface, ctx context.Context) error
  24. }
  25. type StatusInterface interface {
  26. GetStatus() string
  27. SetStatus(s string)
  28. GetOnlineUrl() string
  29. SetOnlineUrl(s string)
  30. }
  31. type VersionInterface interface {
  32. GetVersion() string
  33. SetVersion(v string)
  34. GetVersionName() string
  35. SetVersionName(v string)
  36. CreateVersion(db *gorm.DB, paramID string, obj interface{}) (string, error)
  37. }
  38. type ScheduleInterface interface {
  39. GetStatus() string
  40. GetScheduledStartAt() *time.Time
  41. GetScheduledEndAt() *time.Time
  42. SetScheduledStartAt(v *time.Time)
  43. SetScheduledEndAt(v *time.Time)
  44. GetPublishedAt() *time.Time
  45. GetUnPublishedAt() *time.Time
  46. SetPublishedAt(v *time.Time)
  47. SetUnPublishedAt(v *time.Time)
  48. }
  49. type ListInterface interface {
  50. GetPageNumber() int
  51. SetPageNumber(pageNumber int)
  52. GetPosition() int
  53. SetPosition(position int)
  54. GetListDeleted() bool
  55. SetListDeleted(listDeleted bool)
  56. GetListUpdated() bool
  57. SetListUpdated(listUpdated bool)
  58. }