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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user