使用 goccy/go-json 替代 encoding/json

This commit is contained in:
Shikong 2022-10-04 16:50:14 +08:00
parent 671e6a1d54
commit 16a1217025
2 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package app
import ( import (
"context" "context"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"github.com/goccy/go-json"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/spf13/viper" "github.com/spf13/viper"
"gofiber.study.skcks.cn/common/config" "gofiber.study.skcks.cn/common/config"
@ -88,6 +89,8 @@ func reloadApp(c *config.BasicConfig) *fiber.App {
} }
app := fiber.New(fiber.Config{ app := fiber.New(fiber.Config{
JSONEncoder: json.Marshal,
JSONDecoder: json.Unmarshal,
Prefork: c.Server.PreFork, Prefork: c.Server.PreFork,
CaseSensitive: c.Server.CaseSensitive, CaseSensitive: c.Server.CaseSensitive,
StrictRouting: c.Server.StrictRouting, StrictRouting: c.Server.StrictRouting,

View File

@ -1,7 +1,7 @@
package utils package utils
import ( import (
"encoding/json" "github.com/goccy/go-json"
) )
func Json(data interface{}) string { func Json(data interface{}) string {