feat: implement list memos filter

This commit is contained in:
Steven
2023-09-13 20:42:44 +08:00
parent 9600fbb609
commit d63715d4d9
7 changed files with 117 additions and 95 deletions

View File

@ -57,8 +57,10 @@ type FindMemo struct {
ID *int32
// Standard fields
RowStatus *RowStatus
CreatorID *int32
RowStatus *RowStatus
CreatorID *int32
CreatedTsAfter *int64
CreatedTsBefore *int64
// Domain specific fields
Pinned *bool
@ -131,6 +133,12 @@ func (s *Store) ListMemos(ctx context.Context, find *FindMemo) ([]*Memo, error)
if v := find.RowStatus; v != nil {
where, args = append(where, "memo.row_status = ?"), append(args, *v)
}
if v := find.CreatedTsBefore; v != nil {
where, args = append(where, "memo.created_ts < ?"), append(args, *v)
}
if v := find.CreatedTsAfter; v != nil {
where, args = append(where, "memo.created_ts > ?"), append(args, *v)
}
if v := find.Pinned; v != nil {
where = append(where, "memo_organizer.pinned = 1")
}