Driver is an interface for store driver. It contains all methods that store database driver should implement.
| 8 | // Driver is an interface for store driver. |
| 9 | // It contains all methods that store database driver should implement. |
| 10 | type Driver interface { |
| 11 | GetDB() *sql.DB |
| 12 | Close() error |
| 13 | |
| 14 | IsInitialized(ctx context.Context) (bool, error) |
| 15 | |
| 16 | // GetDatabaseSize returns the database size in bytes, or -1 if unavailable. |
| 17 | // A non-nil error indicates a hard failure; -1 with nil error means the |
| 18 | // driver cannot report a size from the underlying database. |
| 19 | GetDatabaseSize(ctx context.Context) (int64, error) |
| 20 | |
| 21 | // Attachment model related methods. |
| 22 | CreateAttachment(ctx context.Context, create *Attachment) (*Attachment, error) |
| 23 | ListAttachments(ctx context.Context, find *FindAttachment) ([]*Attachment, error) |
| 24 | UpdateAttachment(ctx context.Context, update *UpdateAttachment) error |
| 25 | DeleteAttachment(ctx context.Context, delete *DeleteAttachment) error |
| 26 | DeleteAttachments(ctx context.Context, deletes []*DeleteAttachment) error |
| 27 | |
| 28 | // Memo model related methods. |
| 29 | CreateMemo(ctx context.Context, create *Memo) (*Memo, error) |
| 30 | ListMemos(ctx context.Context, find *FindMemo) ([]*Memo, error) |
| 31 | UpdateMemo(ctx context.Context, update *UpdateMemo) error |
| 32 | DeleteMemo(ctx context.Context, delete *DeleteMemo) error |
| 33 | |
| 34 | // MemoRelation model related methods. |
| 35 | UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error) |
| 36 | ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error) |
| 37 | DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error |
| 38 | |
| 39 | // InstanceSetting model related methods. |
| 40 | UpsertInstanceSetting(ctx context.Context, upsert *InstanceSetting) (*InstanceSetting, error) |
| 41 | ListInstanceSettings(ctx context.Context, find *FindInstanceSetting) ([]*InstanceSetting, error) |
| 42 | DeleteInstanceSetting(ctx context.Context, delete *DeleteInstanceSetting) error |
| 43 | |
| 44 | // User model related methods. |
| 45 | CreateUser(ctx context.Context, create *User) (*User, error) |
| 46 | UpdateUser(ctx context.Context, update *UpdateUser) (*User, error) |
| 47 | ListUsers(ctx context.Context, find *FindUser) ([]*User, error) |
| 48 | DeleteUser(ctx context.Context, delete *DeleteUser) (*DeleteUserResult, error) |
| 49 | |
| 50 | // UserSetting model related methods. |
| 51 | UpsertUserSetting(ctx context.Context, upsert *UserSetting) (*UserSetting, error) |
| 52 | ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*UserSetting, error) |
| 53 | DeleteUserSettings(ctx context.Context, delete *DeleteUserSetting) error |
| 54 | GetUserByPATHash(ctx context.Context, tokenHash string) (*PATQueryResult, error) |
| 55 | |
| 56 | // IdentityProvider model related methods. |
| 57 | CreateIdentityProvider(ctx context.Context, create *IdentityProvider) (*IdentityProvider, error) |
| 58 | ListIdentityProviders(ctx context.Context, find *FindIdentityProvider) ([]*IdentityProvider, error) |
| 59 | UpdateIdentityProvider(ctx context.Context, update *UpdateIdentityProvider) (*IdentityProvider, error) |
| 60 | DeleteIdentityProvider(ctx context.Context, delete *DeleteIdentityProvider) error |
| 61 | |
| 62 | // Inbox model related methods. |
| 63 | CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error) |
| 64 | ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error) |
| 65 | UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error) |
| 66 | DeleteInbox(ctx context.Context, delete *DeleteInbox) error |
| 67 |
no outgoing calls
no test coverage detected