diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-07 08:09:27 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-07 08:09:27 +0800 |
commit | 54d9a5a652c57546e5d9aa30cc58ab2c24a742d9 (patch) | |
tree | 4923a9e577e5bc78d1f623dc8bcda7fe4a6e647e | |
parent | group/index: Fix repo_desc in creation form handler (diff) | |
download | forge-54d9a5a652c57546e5d9aa30cc58ab2c24a742d9.tar.gz forge-54d9a5a652c57546e5d9aa30cc58ab2c24a742d9.tar.zst forge-54d9a5a652c57546e5d9aa30cc58ab2c24a742d9.zip |
database: Remove query_list
-rw-r--r-- | database.go | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/database.go b/database.go index 0459fb7..9068736 100644 --- a/database.go +++ b/database.go @@ -9,31 +9,6 @@ import ( "github.com/jackc/pgx/v5" ) -// query_list is a helper function that executes a query and returns a list of -// results. -func query_list[T any](ctx context.Context, query string, args ...any) (result []T, err error) { - var rows pgx.Rows - - if rows, err = database.Query(ctx, query, args...); err != nil { - return nil, err - } - defer rows.Close() - - for rows.Next() { - var item T - if err = rows.Scan(&item); err != nil { - return nil, err - } - result = append(result, item) - } - - if err = rows.Err(); err != nil { - return nil, err - } - - return result, nil -} - // query_name_desc_list is a helper function that executes a query and returns a // list of name_desc_t results. func query_name_desc_list(ctx context.Context, query string, args ...any) (result []name_desc_t, err error) { |