chore: add time filter to timeline

This commit is contained in:
Steven
2024-01-18 14:30:20 +08:00
parent 7de3de5610
commit d426f89cf0
7 changed files with 88 additions and 27 deletions

View File

@ -46,6 +46,12 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
if v := find.CreatedTsAfter; v != nil {
where, args = append(where, "memo.created_ts > "+placeholder(len(args)+1)), append(args, *v)
}
if v := find.UpdatedTsBefore; v != nil {
where, args = append(where, "memo.updated_ts < "+placeholder(len(args)+1)), append(args, *v)
}
if v := find.UpdatedTsAfter; v != nil {
where, args = append(where, "memo.updated_ts > "+placeholder(len(args)+1)), append(args, *v)
}
if v := find.ContentSearch; len(v) != 0 {
for _, s := range v {
where, args = append(where, "memo.content LIKE "+placeholder(len(args)+1)), append(args, fmt.Sprintf("%%%s%%", s))