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 /git_hooks_handle_other.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 'git_hooks_handle_other.go')
-rw-r--r-- | git_hooks_handle_other.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/git_hooks_handle_other.go b/git_hooks_handle_other.go index 6d5b08d..ed75e7a 100644 --- a/git_hooks_handle_other.go +++ b/git_hooks_handle_other.go @@ -211,12 +211,12 @@ func (s *server) hooksHandler(conn net.Conn) { var newMRLocalID int if packPass.userID != 0 { - err = database.QueryRow(ctx, + err = s.database.QueryRow(ctx, "INSERT INTO merge_requests (repo_id, creator, source_ref, status) VALUES ($1, $2, $3, 'open') RETURNING repo_local_id", packPass.repoID, packPass.userID, strings.TrimPrefix(refName, "refs/heads/"), ).Scan(&newMRLocalID) } else { - err = database.QueryRow(ctx, + err = s.database.QueryRow(ctx, "INSERT INTO merge_requests (repo_id, source_ref, status) VALUES ($1, $2, 'open') RETURNING repo_local_id", packPass.repoID, strings.TrimPrefix(refName, "refs/heads/"), ).Scan(&newMRLocalID) @@ -237,7 +237,7 @@ func (s *server) hooksHandler(conn net.Conn) { var existingMRUser int var isAncestor bool - err = database.QueryRow(ctx, + err = s.database.QueryRow(ctx, "SELECT COALESCE(creator, 0) FROM merge_requests WHERE source_ref = $1 AND repo_id = $2", strings.TrimPrefix(refName, "refs/heads/"), packPass.repoID, ).Scan(&existingMRUser) |