diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 20:26:57 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 20:26:57 +0800 |
commit | 20b4fe0c59357a433042732d46e38da9c3d14c3b (patch) | |
tree | 537d7d450701a839802b1d57a82bd07324dcba90 /http_handle_repo_contrib_index.go | |
parent | misc: Move utils.go's string function to misc (diff) | |
download | forge-20b4fe0c59357a433042732d46e38da9c3d14c3b.tar.gz forge-20b4fe0c59357a433042732d46e38da9c3d14c3b.tar.zst forge-20b4fe0c59357a433042732d46e38da9c3d14c3b.zip |
database shall no longer be a global variable
Diffstat (limited to 'http_handle_repo_contrib_index.go')
-rw-r--r-- | http_handle_repo_contrib_index.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/http_handle_repo_contrib_index.go b/http_handle_repo_contrib_index.go index ee7b956..e0c8478 100644 --- a/http_handle_repo_contrib_index.go +++ b/http_handle_repo_contrib_index.go @@ -18,12 +18,12 @@ type idTitleStatus struct { } // httpHandleRepoContribIndex provides an index to merge requests of a repo. -func httpHandleRepoContribIndex(writer http.ResponseWriter, request *http.Request, params map[string]any) { +func (s *server) httpHandleRepoContribIndex(writer http.ResponseWriter, request *http.Request, params map[string]any) { var rows pgx.Rows var result []idTitleStatus var err error - if rows, err = database.Query(request.Context(), + if rows, err = s.database.Query(request.Context(), "SELECT repo_local_id, COALESCE(title, 'Untitled'), status FROM merge_requests WHERE repo_id = $1", params["repo_id"], ); err != nil { |