search: фильтры created_ts переведены на timestamp для memos 0.30

В memos 0.30.0 поле created_ts в CEL стало типом timestamp, и сравнение
с Unix-числом перестало компилироваться. Границы диапазона теперь
формируются как timestamp("<RFC3339>") в UTC.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
av
2026-08-06 12:21:53 +03:00
co-authored by Claude Opus 5
parent c3acb50fcc
commit 8e8cc990c4
2 changed files with 14 additions and 4 deletions
+9 -2
View File
@@ -13,9 +13,16 @@ type DateRange struct {
}
// BuildCELFilter creates a CEL filter string for a date range using created_ts.
// Since memos 0.30 created_ts is a CEL timestamp, so plain Unix ints are not
// comparable with it — the bounds must be wrapped in timestamp().
func BuildCELFilter(dr DateRange) string {
return fmt.Sprintf("created_ts >= %d && created_ts < %d",
dr.Start.Unix(), dr.End.Unix())
return fmt.Sprintf("created_ts >= timestamp(%q) && created_ts < timestamp(%q)",
formatCELTimestamp(dr.Start), formatCELTimestamp(dr.End))
}
// formatCELTimestamp renders a time as an RFC3339 literal in UTC.
func formatCELTimestamp(t time.Time) string {
return t.UTC().Format(time.RFC3339)
}
func isLeapYear(year int) bool {