修改gin包为ginx
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
package ginx
|
||||
|
||||
import (
|
||||
"code.yun.ink/pkg/responsex"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Error(ctx *gin.Context, err error, ops ...responsex.Option) {
|
||||
responsex.Error(ctx, ctx.Writer, err, ops...)
|
||||
}
|
||||
|
||||
func ErrorWithData(ctx *gin.Context, err error, data any, ops ...responsex.Option) {
|
||||
responsex.ErrorWithData(ctx, ctx.Writer, err, data, ops...)
|
||||
}
|
||||
|
||||
func ErrorStr(ctx *gin.Context, msg string, ops ...responsex.Option) {
|
||||
responsex.ErrorStr(ctx, ctx.Writer, msg, ops...)
|
||||
}
|
||||
|
||||
func Success(ctx *gin.Context, data any, ops ...responsex.Option) {
|
||||
responsex.Success(ctx, ctx.Writer, data, ops...)
|
||||
}
|
||||
|
||||
func SuccessWithPage(ctx *gin.Context, data any, page responsex.Pagination, ops ...responsex.Option) {
|
||||
responsex.SuccessWithPage(ctx, ctx.Writer, data, &page, ops...)
|
||||
}
|
||||
|
||||
func Custom(ctx *gin.Context, ops ...responsex.Option) {
|
||||
responsex.ResponseCtx(ctx, ctx.Writer, ops...)
|
||||
}
|
||||
|
||||
func MsgMapData(ctx *gin.Context, msgKey string, format map[string]string, data any, ops ...responsex.Option) {
|
||||
responsex.FormatMessage(ctx, ctx.Writer, msgKey, format, data, ops...)
|
||||
}
|
||||
|
||||
func MsgKV(ctx *gin.Context, msgKey string, k string, v string, ops ...responsex.Option) {
|
||||
responsex.FormatMessage(ctx, ctx.Writer, msgKey, map[string]string{k: v}, nil, ops...)
|
||||
}
|
||||
Reference in New Issue
Block a user