TaskBySessionID returns the task bound to the given Claude session UUID, or sql.ErrNoRows if none. The partial unique index on tasks(session_id) WHERE session_id IS NOT NULL guarantees at most one row. Empty sid is treated as "no binding" and returns ErrNoRows without hitting the DB.
(db *sql.DB, sid string)
| 755 | // one row. Empty sid is treated as "no binding" and returns ErrNoRows |
| 756 | // without hitting the DB. |
| 757 | func TaskBySessionID(db *sql.DB, sid string) (*Task, error) { |
| 758 | if sid == "" { |
| 759 | return nil, sql.ErrNoRows |
| 760 | } |
| 761 | row := db.QueryRow("SELECT "+TaskCols+" FROM tasks WHERE session_id = ? LIMIT 1", sid) |
| 762 | return ScanTask(row) |
| 763 | } |
| 764 | |
| 765 | func ListTasks(db *sql.DB, filter TaskFilter) ([]*Task, error) { |
| 766 | var where []string |
no test coverage detected