From 475e5a5e9583c80d52a7da5d3bfe3700703d64bc Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Feb 2025 10:56:09 +0800 Subject: {group_,}index: Use name_desc_t --- http_handle_index.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'http_handle_index.go') diff --git a/http_handle_index.go b/http_handle_index.go index e36332d..41a55e8 100644 --- a/http_handle_index.go +++ b/http_handle_index.go @@ -12,20 +12,14 @@ func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any) } defer rows.Close() - groups := []struct { - Name string - Description string - }{} + groups := []name_desc_t{} for rows.Next() { var groupName, groupDescription string if err := rows.Scan(&groupName, &groupDescription); err != nil { http.Error(w, "Error scanning group: "+err.Error(), http.StatusInternalServerError) return } - groups = append(groups, struct { - Name string - Description string - }{groupName, groupDescription}) + groups = append(groups, name_desc_t{groupName, groupDescription}) } if err := rows.Err(); err != nil { -- cgit v1.2.3