(w http.ResponseWriter, status int, payload any)
| 1318 | } |
| 1319 | |
| 1320 | func writeJSON(w http.ResponseWriter, status int, payload any) { |
| 1321 | w.Header().Set("Content-Type", "application/json; charset=utf-8") |
| 1322 | w.WriteHeader(status) |
| 1323 | if err := json.NewEncoder(w).Encode(payload); err != nil { |
| 1324 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 1325 | } |
| 1326 | } |
| 1327 | |
| 1328 | // adminStoreAdapter 将 users.Store 适配为 auth.AdminStore 接口。 |
| 1329 | type adminStoreAdapter struct{ s users.Store } |
no test coverage detected