memos/store/driver.go

82 lines
3.9 KiB
Go
Raw Normal View History

package store
import (
"context"
2023-09-29 09:15:54 +08:00
"database/sql"
)
2023-10-05 23:11:29 +08:00
// Driver is an interface for store driver.
// It contains all methods that store database driver should implement.
type Driver interface {
2023-09-29 09:15:54 +08:00
GetDB() *sql.DB
Close() error
2023-11-06 08:33:31 +08:00
// MigrationHistory model related methods.
FindMigrationHistoryList(ctx context.Context, find *FindMigrationHistory) ([]*MigrationHistory, error)
UpsertMigrationHistory(ctx context.Context, upsert *UpsertMigrationHistory) (*MigrationHistory, error)
2023-10-05 23:11:29 +08:00
// Activity model related methods.
CreateActivity(ctx context.Context, create *Activity) (*Activity, error)
2023-10-27 01:11:41 +08:00
ListActivities(ctx context.Context, find *FindActivity) ([]*Activity, error)
2023-10-05 23:11:29 +08:00
// Resource model related methods.
CreateResource(ctx context.Context, create *Resource) (*Resource, error)
ListResources(ctx context.Context, find *FindResource) ([]*Resource, error)
2024-05-02 21:28:06 +08:00
UpdateResource(ctx context.Context, update *UpdateResource) error
DeleteResource(ctx context.Context, delete *DeleteResource) error
2023-10-05 23:11:29 +08:00
// Memo model related methods.
CreateMemo(ctx context.Context, create *Memo) (*Memo, error)
ListMemos(ctx context.Context, find *FindMemo) ([]*Memo, error)
UpdateMemo(ctx context.Context, update *UpdateMemo) error
DeleteMemo(ctx context.Context, delete *DeleteMemo) error
2023-10-05 23:11:29 +08:00
// MemoRelation model related methods.
UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error)
ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error)
DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error
2023-10-05 23:11:29 +08:00
// MemoOrganizer model related methods.
UpsertMemoOrganizer(ctx context.Context, upsert *MemoOrganizer) (*MemoOrganizer, error)
ListMemoOrganizer(ctx context.Context, find *FindMemoOrganizer) ([]*MemoOrganizer, error)
DeleteMemoOrganizer(ctx context.Context, delete *DeleteMemoOrganizer) error
// WorkspaceSetting model related methods.
UpsertWorkspaceSetting(ctx context.Context, upsert *WorkspaceSetting) (*WorkspaceSetting, error)
ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*WorkspaceSetting, error)
DeleteWorkspaceSetting(ctx context.Context, delete *DeleteWorkspaceSetting) error
2023-10-05 23:11:29 +08:00
// User model related methods.
CreateUser(ctx context.Context, create *User) (*User, error)
UpdateUser(ctx context.Context, update *UpdateUser) (*User, error)
ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
DeleteUser(ctx context.Context, delete *DeleteUser) error
2023-10-05 23:11:29 +08:00
// UserSetting model related methods.
2024-04-13 02:08:35 +08:00
UpsertUserSetting(ctx context.Context, upsert *UserSetting) (*UserSetting, error)
ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*UserSetting, error)
2023-09-26 19:17:17 +08:00
2023-10-05 23:11:29 +08:00
// IdentityProvider model related methods.
2023-09-26 19:17:17 +08:00
CreateIdentityProvider(ctx context.Context, create *IdentityProvider) (*IdentityProvider, error)
ListIdentityProviders(ctx context.Context, find *FindIdentityProvider) ([]*IdentityProvider, error)
UpdateIdentityProvider(ctx context.Context, update *UpdateIdentityProvider) (*IdentityProvider, error)
DeleteIdentityProvider(ctx context.Context, delete *DeleteIdentityProvider) error
2023-09-26 19:37:22 +08:00
2023-10-27 01:10:19 +08:00
// Inbox model related methods.
CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error)
2023-10-28 00:08:42 +08:00
ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error)
2023-10-27 01:10:19 +08:00
UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error)
DeleteInbox(ctx context.Context, delete *DeleteInbox) error
2023-11-24 22:45:38 +08:00
// Webhook model related methods.
2024-04-13 11:54:37 +08:00
CreateWebhook(ctx context.Context, create *Webhook) (*Webhook, error)
ListWebhooks(ctx context.Context, find *FindWebhook) ([]*Webhook, error)
UpdateWebhook(ctx context.Context, update *UpdateWebhook) (*Webhook, error)
2023-11-24 22:45:38 +08:00
DeleteWebhook(ctx context.Context, delete *DeleteWebhook) error
2024-02-07 23:40:23 +08:00
// Reaction model related methods.
2024-04-13 11:54:37 +08:00
UpsertReaction(ctx context.Context, create *Reaction) (*Reaction, error)
ListReactions(ctx context.Context, find *FindReaction) ([]*Reaction, error)
2024-02-07 23:40:23 +08:00
DeleteReaction(ctx context.Context, delete *DeleteReaction) error
}