chore: deps
This commit is contained in:
5 files changed
+39
-219
No files matched your search
@@ -113,8 +113,9 @@ func httpServer(c *console, app *appState) error {
|
||||
uriarg := ""
|
||||
uri := r.URL.Query().Get("uri")
|
||||
if uri != "" {
|
||||
uriarg = "and uri = ?"
|
||||
args = append(args, uri)
|
||||
feed_id := urlNS.UUID5(uri)
|
||||
uriarg = "and feed_id = ?"
|
||||
args = append(args, feed_id)
|
||||
}
|
||||
|
||||
limit := 100
|
||||
@@ -126,7 +127,6 @@ func httpServer(c *console, app *appState) error {
|
||||
if v, ok := strconv.Atoi(r.URL.Query().Get("offset")); ok == nil {
|
||||
offset = v
|
||||
}
|
||||
args = append(args, limit, offset)
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
rows, err := db.QueryContext(
|
||||
@@ -198,22 +198,30 @@ func httpServer(c *console, app *appState) error {
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
|
||||
where := `where parent_id is null and state not in ('permanantly-dead', 'frozen') and last_twt_on is not null`
|
||||
args := make([]any, 0)
|
||||
if uri := r.URL.Query().Get("uri"); uri != "" {
|
||||
where = `where feed_id = ? or parent_id = ?`
|
||||
feed_id := urlNS.UUID5(uri)
|
||||
args = append(args, feed_id, feed_id)
|
||||
}
|
||||
|
||||
rows, err := db.QueryContext(
|
||||
ctx,
|
||||
`SELECT
|
||||
feed_id,
|
||||
uri,
|
||||
nick,
|
||||
last_scan_on,
|
||||
last_twt_on
|
||||
FROM feeds
|
||||
left join (
|
||||
select feed_id, max(strftime('%Y-%m-%dT%H:%M:%fZ', (substring(text, 1, instr(text, ' ')-1)))) last_twt_on
|
||||
from twts group by feed_id
|
||||
) using (feed_id)
|
||||
where parent_id is null and state not in ('permanantly-dead', 'frozen') and last_twt_on is not null
|
||||
order by nick, uri
|
||||
`,
|
||||
feed_id,
|
||||
uri,
|
||||
nick,
|
||||
last_scan_on,
|
||||
last_twt_on
|
||||
FROM feeds
|
||||
left join (
|
||||
select feed_id, max(strftime('%Y-%m-%dT%H:%M:%fZ', (substring(text, 1, instr(text, ' ')-1)))) last_twt_on
|
||||
from twts group by feed_id
|
||||
) using (feed_id)
|
||||
`+where+`
|
||||
order by nick, uri
|
||||
`,args...,
|
||||
)
|
||||
if err != nil {
|
||||
span.RecordError(err)
|
||||
|
||||
Reference in new issue
Block a user