1 Star 0 Fork 0

linxing/youye-core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
resp_writer.go 935 Bytes
一键复制 编辑 原始数据 按行查看 历史
Mark 提交于 2024-03-18 11:31 . feat: app add plugin
package gin
import (
"gitee.com/linxing_3/youye-core/sdk/pkg/response"
"github.com/gin-gonic/gin"
)
var _ response.IRespWriter = (*GinWriter)(nil)
func NewGinRespWriter(gin *gin.Context) *GinWriter {
return &GinWriter{gin: gin}
}
type GinWriter struct {
gin *gin.Context
}
// AbortWithStatusJSON implements response.IRespWriter.
func (g *GinWriter) AbortWithStatusJSON(code int, obj any) {
g.gin.AbortWithStatusJSON(code, obj)
}
// Get implements response.IRespWriter.
func (g *GinWriter) Get(key string) (val any, exists bool) {
return g.gin.Get(key)
}
// GetHeader implements response.IRespWriter.
func (g *GinWriter) GetHeader(key string) string {
return g.gin.GetHeader(key)
}
// Set implements response.IRespWriter.
func (g *GinWriter) Set(key string, val any) {
g.gin.Set(key, val)
}
// SetHeader implements response.IRespWriter.
func (g *GinWriter) SetHeader(key string, val string) {
g.gin.Header(key, val)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/linxing_3/youye-core.git
git@gitee.com:linxing_3/youye-core.git
linxing_3
youye-core
youye-core
v0.0.1-202403301034

搜索帮助