persistence: now using Row Value Comparsions as it should been using
This commit is contained in:
parent
e20cdca890
commit
cab54c6ec1
@ -203,10 +203,9 @@ func (db *sqlite3Database) QueryTorrents(
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
WHERE modified_on <= ?
|
WHERE modified_on <= ?
|
||||||
{{ if not .FirstPage }}
|
{{ if not .FirstPage }}
|
||||||
AND id > ?
|
AND ( {{.OrderOn}}, id ) {{GTEorLTE .Ascending}} (?, ?) -- https://www.sqlite.org/rowvalue.html#row_value_comparisons
|
||||||
AND {{ .OrderOn }} {{ GTEorLTE .Ascending }} ?
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
ORDER BY {{ .OrderOn }} {{ AscOrDesc .Ascending }}, id ASC
|
ORDER BY {{.OrderOn}} {{AscOrDesc .Ascending}}, id {{AscOrDesc .Ascending}}
|
||||||
LIMIT ?;
|
LIMIT ?;
|
||||||
`, struct {
|
`, struct {
|
||||||
DoJoin bool
|
DoJoin bool
|
||||||
@ -220,7 +219,6 @@ func (db *sqlite3Database) QueryTorrents(
|
|||||||
Ascending: ascending,
|
Ascending: ascending,
|
||||||
}, template.FuncMap{
|
}, template.FuncMap{
|
||||||
"GTEorLTE": func(ascending bool) string {
|
"GTEorLTE": func(ascending bool) string {
|
||||||
// TODO: or maybe vice versa idk
|
|
||||||
if ascending {
|
if ascending {
|
||||||
return ">"
|
return ">"
|
||||||
} else {
|
} else {
|
||||||
@ -243,8 +241,8 @@ func (db *sqlite3Database) QueryTorrents(
|
|||||||
}
|
}
|
||||||
queryArgs = append(queryArgs, epoch)
|
queryArgs = append(queryArgs, epoch)
|
||||||
if !firstPage {
|
if !firstPage {
|
||||||
queryArgs = append(queryArgs, lastID)
|
|
||||||
queryArgs = append(queryArgs, lastOrderedValue)
|
queryArgs = append(queryArgs, lastOrderedValue)
|
||||||
|
queryArgs = append(queryArgs, lastID)
|
||||||
}
|
}
|
||||||
queryArgs = append(queryArgs, limit)
|
queryArgs = append(queryArgs, limit)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user