feat: init api, db, app

This commit is contained in:
2024-11-07 19:07:41 +00:00
parent ab9b3368d1
commit 11b063c2fa
43 changed files with 1487 additions and 137 deletions
+14
View File
@@ -0,0 +1,14 @@
package utils
import "github.com/gofiber/fiber/v2"
func ResponseError(c *fiber.Ctx, err error, status int) error {
if status == 0 {
status = fiber.StatusInternalServerError
}
return &fiber.Error{
Code: status,
Message: err.Error(),
}
}
+15
View File
@@ -0,0 +1,15 @@
package utils
import "encoding/json"
func ParseMapInterface(data interface{}, out interface{}) error {
// Marshal the map to JSON
jsonData, err := json.Marshal(data)
if err != nil {
return err
}
// Unmarshal the JSON data into the struct
err = json.Unmarshal(jsonData, &out)
return err
}