mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Fix time since
This commit is contained in:
@@ -279,12 +279,14 @@ func (q *Query) Placeholders(n int) *Query {
|
|||||||
return q
|
return q
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Query) TimeSince(days int) string {
|
func (q *Query) TimeSince(days int) *Query {
|
||||||
if q.dbType == DBTypePostgres {
|
if q.dbType == DBTypePostgres {
|
||||||
return fmt.Sprintf("NOW() - INTERVAL '%d days'", days)
|
q.builder.WriteString(fmt.Sprintf("NOW() - INTERVAL '%d days'", days))
|
||||||
|
} else {
|
||||||
|
q.builder.WriteString(fmt.Sprintf("datetime('now', '-%d days')", days))
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("datetime('now', '-%d days')", days)
|
return q
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddArgs adds arguments to the query
|
// AddArgs adds arguments to the query
|
||||||
|
|||||||
Reference in New Issue
Block a user