-
Notifications
You must be signed in to change notification settings - Fork 2
/
findrunresult.xo.go
39 lines (35 loc) · 959 Bytes
/
findrunresult.xo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package models
// Code generated by xo. DO NOT EDIT.
import (
"context"
)
// FindRunResult represents a row from 'find_run_result'.
type FindRunResult struct {
ID string `json:"id"` // id
}
// FindRunResultsByPathValue runs a custom query, returning results as FindRunResult.
func FindRunResultsByPathValue(ctx context.Context, db DB, path string, value any) ([]*FindRunResult, error) {
// query
const sqlstr = `SELECT id FROM runs WHERE json_extract('meta', $1) = $2 ORDER BY start_time DESC LIMIT 50`
// run
logf(sqlstr, path, value)
rows, err := db.QueryContext(ctx, sqlstr, path, value)
if err != nil {
return nil, logerror(err)
}
defer rows.Close()
// load results
var res []*FindRunResult
for rows.Next() {
var frr FindRunResult
// scan
if err := rows.Scan(&frr.ID); err != nil {
return nil, logerror(err)
}
res = append(res, &frr)
}
if err := rows.Err(); err != nil {
return nil, logerror(err)
}
return res, nil
}