我有一个方法,它获取用户 ID 列表并返回用户详细信息列表。
func ListUser(userIDs []interface{}) (users []User, err error) {
// query on DB based on userID and return list of users
return users, nil
}
现在我想为其公开一个 API 端点。因此,我尝试从我的 URL 获取用户 ID。
func ListUserProfile(w http.ResponseWriter, r *http.Request) {
// I know I can get the single value using
//r.URL.Query().Get("user-id")
// but here List user takes []interface{} as a argument
users, err := users.ListUser(userIDs)
}
有什么方法可以从我的 URL 获取 userIDS 列表吗?
慕容708150
相关分类