change to go fiber and update selectors
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"ron"
|
||||
|
||||
"gopher-toolbox/app"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/zepyrshut/rating-orama/internal/repository"
|
||||
)
|
||||
|
||||
@@ -22,38 +21,10 @@ func New(app *app.App, q repository.ExtendedQuerier) *Handlers {
|
||||
}
|
||||
}
|
||||
|
||||
func (hq *Handlers) ToBeImplemented(c *ron.CTX, ctx context.Context) {
|
||||
c.JSON(http.StatusOK, ron.Data{
|
||||
"message": "To be implemented",
|
||||
})
|
||||
func (hq *Handlers) ToBeImplemented(c *fiber.Ctx) error {
|
||||
return c.Status(http.StatusNotImplemented).JSON("not implemented")
|
||||
}
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
func (hq *Handlers) Ping(c *gin.Context) {
|
||||
slog.Info("ping", RequestID, c.Request.Context().Value(RequestID))
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
=======
|
||||
func (hq *Handlers) Ping(c *ron.CTX, ctx context.Context) {
|
||||
c.JSON(http.StatusOK, ron.Data{
|
||||
>>>>>>> Stashed changes
|
||||
"message": "pong",
|
||||
})
|
||||
func (hq *Handlers) Ping(c *fiber.Ctx) error {
|
||||
return c.JSON("pong")
|
||||
}
|
||||
|
||||
// // TODO: Extract to toolbox
|
||||
// func handleQueryError(c *gin.Context, err error, errorMap map[string]string, logMessage string, defaultErrorMessage string) bool {
|
||||
// if err != nil {
|
||||
// for key, message := range errorMap {
|
||||
// if strings.Contains(err.Error(), key) {
|
||||
// slog.Error(logMessage, "error", message, RequestID, c.Request.Context().Value(RequestID))
|
||||
// c.JSON(http.StatusConflict, gin.H{"error": message})
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
|
||||
// slog.Error(logMessage, "error", err.Error(), RequestID, c.Request.Context().Value(RequestID))
|
||||
// c.JSON(http.StatusInternalServerError, gin.H{"error": defaultErrorMessage})
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user