Navigate to snapshots from the transcript
This commit is contained in:
@@ -46,6 +46,14 @@ func (s *Store) ListSnapshots(ctx context.Context, taskID string) ([]api.Snapsho
|
||||
return snaps, rows.Err()
|
||||
}
|
||||
|
||||
func (s *Store) GetSnapshot(ctx context.Context, taskID string, n int) (api.Snapshot, error) {
|
||||
snap, err := scanSnapshot(s.db.QueryRowContext(ctx, `SELECT `+snapshotColumns+` FROM snapshots WHERE task_id = ? AND n = ?`, taskID, n))
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return snap, ErrNotFound
|
||||
}
|
||||
return snap, err
|
||||
}
|
||||
|
||||
func (s *Store) LastSnapshot(ctx context.Context, taskID string) (api.Snapshot, error) {
|
||||
snap, err := scanSnapshot(s.db.QueryRowContext(ctx, `SELECT `+snapshotColumns+` FROM snapshots WHERE task_id = ? ORDER BY n DESC LIMIT 1`, taskID))
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
|
||||
Reference in New Issue
Block a user