package e import ( "git.0x7f.app/WOJ/woj-server/pkg/utils" "github.com/gin-gonic/gin" "net/http" ) type Response[T any] struct { Code int `json:"code"` Msg string `json:"msg"` Body T `json:"body"` } func wrap[T any](status Status, body T) Response[interface{}] { return Response[interface{}]{ Code: int(status), Msg: status.String(), Body: utils.If[interface{}](status == Success, body, nil), } } func Pong[T any](c *gin.Context, status Status, body T) { c.Set("err", status) c.JSON(http.StatusOK, wrap(status, body)) }