feat: login service and implement database storage

This commit is contained in:
ericprd
2025-02-23 22:34:26 +08:00
parent a95a5ca521
commit 5fcb5c2cd5
24 changed files with 576 additions and 8 deletions
+23
View File
@@ -0,0 +1,23 @@
package response
import (
"context"
"encoding/json"
"net/http"
)
type Response[T any] struct {
Data T `json:"data"`
}
func RespondJsonSuccess[T any](ctx context.Context, w http.ResponseWriter, data T) {
setDefaultHeaders(ctx, w.Header())
w.WriteHeader(http.StatusOK)
b, _ := json.Marshal(Response[T]{
Data: data,
})
w.Write(b)
}