driver.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package store
  2. import (
  3. "context"
  4. "database/sql"
  5. )
  6. // Driver is an interface for store driver.
  7. // It contains all methods that store database driver should implement.
  8. type Driver interface {
  9. GetDB() *sql.DB
  10. Close() error
  11. // MigrationHistory model related methods.
  12. FindMigrationHistoryList(ctx context.Context, find *FindMigrationHistory) ([]*MigrationHistory, error)
  13. UpsertMigrationHistory(ctx context.Context, upsert *UpsertMigrationHistory) (*MigrationHistory, error)
  14. // Activity model related methods.
  15. CreateActivity(ctx context.Context, create *Activity) (*Activity, error)
  16. ListActivities(ctx context.Context, find *FindActivity) ([]*Activity, error)
  17. // Resource model related methods.
  18. CreateResource(ctx context.Context, create *Resource) (*Resource, error)
  19. ListResources(ctx context.Context, find *FindResource) ([]*Resource, error)
  20. UpdateResource(ctx context.Context, update *UpdateResource) error
  21. DeleteResource(ctx context.Context, delete *DeleteResource) error
  22. // Memo model related methods.
  23. CreateMemo(ctx context.Context, create *Memo) (*Memo, error)
  24. ListMemos(ctx context.Context, find *FindMemo) ([]*Memo, error)
  25. UpdateMemo(ctx context.Context, update *UpdateMemo) error
  26. DeleteMemo(ctx context.Context, delete *DeleteMemo) error
  27. // MemoRelation model related methods.
  28. UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error)
  29. ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error)
  30. DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error
  31. // MemoOrganizer model related methods.
  32. UpsertMemoOrganizer(ctx context.Context, upsert *MemoOrganizer) (*MemoOrganizer, error)
  33. ListMemoOrganizer(ctx context.Context, find *FindMemoOrganizer) ([]*MemoOrganizer, error)
  34. DeleteMemoOrganizer(ctx context.Context, delete *DeleteMemoOrganizer) error
  35. // WorkspaceSetting model related methods.
  36. UpsertWorkspaceSetting(ctx context.Context, upsert *WorkspaceSetting) (*WorkspaceSetting, error)
  37. ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*WorkspaceSetting, error)
  38. DeleteWorkspaceSetting(ctx context.Context, delete *DeleteWorkspaceSetting) error
  39. // User model related methods.
  40. CreateUser(ctx context.Context, create *User) (*User, error)
  41. UpdateUser(ctx context.Context, update *UpdateUser) (*User, error)
  42. ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
  43. DeleteUser(ctx context.Context, delete *DeleteUser) error
  44. // UserSetting model related methods.
  45. UpsertUserSetting(ctx context.Context, upsert *UserSetting) (*UserSetting, error)
  46. ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*UserSetting, error)
  47. // IdentityProvider model related methods.
  48. CreateIdentityProvider(ctx context.Context, create *IdentityProvider) (*IdentityProvider, error)
  49. ListIdentityProviders(ctx context.Context, find *FindIdentityProvider) ([]*IdentityProvider, error)
  50. UpdateIdentityProvider(ctx context.Context, update *UpdateIdentityProvider) (*IdentityProvider, error)
  51. DeleteIdentityProvider(ctx context.Context, delete *DeleteIdentityProvider) error
  52. // Inbox model related methods.
  53. CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error)
  54. ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error)
  55. UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error)
  56. DeleteInbox(ctx context.Context, delete *DeleteInbox) error
  57. // Webhook model related methods.
  58. CreateWebhook(ctx context.Context, create *Webhook) (*Webhook, error)
  59. ListWebhooks(ctx context.Context, find *FindWebhook) ([]*Webhook, error)
  60. UpdateWebhook(ctx context.Context, update *UpdateWebhook) (*Webhook, error)
  61. DeleteWebhook(ctx context.Context, delete *DeleteWebhook) error
  62. // Reaction model related methods.
  63. UpsertReaction(ctx context.Context, create *Reaction) (*Reaction, error)
  64. ListReactions(ctx context.Context, find *FindReaction) ([]*Reaction, error)
  65. DeleteReaction(ctx context.Context, delete *DeleteReaction) error
  66. }