vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Show an issue's linked changes and commits in the sidebar
fd9aa8ed41eb04a21fe73fbc0c6bd14762abd735 · Keenan Nemetz · 23h ago · parent c980fe53
forge/index/requests.go +33
| @@ -118,6 +118,39 @@ func (s *Store) Requests(repoID string, f RequestFilter) ([]RequestRow, error) { | |||
| 118 | 118 | return nil, err | |
| 119 | 119 | } | |
| 120 | 120 | defer rows.Close() | |
| 121 | return scanRequestRows(rows) | ||
| 122 | } | ||
| 123 | |||
| 124 | // RequestsByID returns the indexed rows for the named requests, keyed by id. An | ||
| 125 | // issue page asks for the changes that link to it, and it needs the same facts a | ||
| 126 | // list row shows rather than each request's conversation. | ||
| 127 | func (s *Store) RequestsByID(repoID string, ids []string) (map[string]RequestRow, error) { | ||
| 128 | out := make(map[string]RequestRow, len(ids)) | ||
| 129 | if len(ids) == 0 { | ||
| 130 | return out, nil | ||
| 131 | } | ||
| 132 | args := make([]any, 0, len(ids)+1) | ||
| 133 | args = append(args, repoID) | ||
| 134 | for _, id := range ids { | ||
| 135 | args = append(args, id) | ||
| 136 | } | ||
| 137 | q := requestSelect + ` WHERE r.repo_id=? AND r.id IN (?` + strings.Repeat(",?", len(ids)-1) + `)` | ||
| 138 | rows, err := s.db.Query(q, args...) | ||
| 139 | if err != nil { | ||
| 140 | return nil, err | ||
| 141 | } | ||
| 142 | defer rows.Close() | ||
| 143 | list, err := scanRequestRows(rows) | ||
| 144 | if err != nil { | ||
| 145 | return nil, err | ||
| 146 | } | ||
| 147 | for _, r := range list { | ||
| 148 | out[r.ID] = r | ||
| 149 | } | ||
| 150 | return out, nil | ||
| 151 | } | ||
| 152 | |||
| 153 | func scanRequestRows(rows *sql.Rows) ([]RequestRow, error) { | ||
| 121 | 154 | var out []RequestRow | |
| 122 | 155 | for rows.Next() { | |
| 123 | 156 | var r RequestRow | |