(ctx context.Context, q queryer, id int64)
| 199 | } |
| 200 | |
| 201 | func installsFor(ctx context.Context, q queryer, id int64) ([]Install, error) { |
| 202 | rows, err := q.QueryContext(ctx, `SELECT id, app, level, project_dir, target_path, link_kind, created_at FROM instruction_installs WHERE instruction_id = ? ORDER BY id`, id) |
| 203 | if err != nil { |
| 204 | return nil, fmt.Errorf("instructions: list installs: %w", err) |
| 205 | } |
| 206 | defer rows.Close() |
| 207 | var out []Install |
| 208 | for rows.Next() { |
| 209 | var ins Install |
| 210 | var created string |
| 211 | if err := rows.Scan(&ins.ID, &ins.App, &ins.Level, &ins.ProjectDir, &ins.TargetPath, &ins.LinkKind, &created); err != nil { |
| 212 | return nil, fmt.Errorf("instructions: scan install: %w", err) |
| 213 | } |
| 214 | ins.CreatedAt = parseTime(created) |
| 215 | out = append(out, ins) |
| 216 | } |
| 217 | return out, rows.Err() |
| 218 | } |
| 219 | |
| 220 | // nameExists reports whether a row with name exists, optionally excluding an id. |
| 221 | func nameExists(ctx context.Context, q queryer, name string, excludeID int64) (bool, error) { |
no test coverage detected