forked from usememos/memos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
memo_organizer.go
47 lines (37 loc) · 988 Bytes
/
memo_organizer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package store
import (
"context"
"errors"
)
type MemoOrganizer struct {
MemoID int32
UserID int32
Pinned bool
}
type FindMemoOrganizer struct {
MemoID int32
UserID int32
}
type DeleteMemoOrganizer struct {
MemoID *int32
UserID *int32
}
func (s *Store) UpsertMemoOrganizer(ctx context.Context, upsert *MemoOrganizer) (*MemoOrganizer, error) {
return s.driver.UpsertMemoOrganizer(ctx, upsert)
}
func (s *Store) GetMemoOrganizer(ctx context.Context, find *FindMemoOrganizer) (*MemoOrganizer, error) {
list, err := s.ListMemoOrganizer(ctx, find)
if err != nil {
return nil, err
}
if len(list) == 0 {
return nil, errors.New("not found")
}
return list[0], nil
}
func (s *Store) ListMemoOrganizer(ctx context.Context, find *FindMemoOrganizer) ([]*MemoOrganizer, error) {
return s.driver.ListMemoOrganizer(ctx, find)
}
func (s *Store) DeleteMemoOrganizer(ctx context.Context, delete *DeleteMemoOrganizer) error {
return s.driver.DeleteMemoOrganizer(ctx, delete)
}