代码拉取完成,页面将自动刷新
package extend
type ExtendsRegister struct {
Cpdr ContextPathDuplicateRemoval // swagger查询api接口时,把根路径去掉,打开swagger页面时,url根路径会重复,如果没有重复可以不启用
Vem ValidatorErrorMessages // 自定义Validator验证错误描述信息
Cgwh CustomGinWrapHandler // 自定义gin.handler包装器,默认为panic统一拦截器
Acwh AssembleCustomWrapHandler // 把每个gin.Handler包装一层自定义CustomGinWrapHandler
Cver CustomValidatorErrorRes // 自定义参数验证错误响应体,默认为自定义的Result结构体
Cp ContextPath // 根路径:http://localhost:8080/example/doc.html# example为根路径
}
var ExtendsRegisterDefault ExtendsRegister
// ExtendsRegisterDefaultInit 扩展器初始化函数,可自定义
func ExtendsRegisterDefaultInit(rootPath string) {
ExtendsRegisterDefault = ExtendsRegister{Cpdr: &duplicateRemoval{isEnable: true},
Vem: &errorMessages{isEnable: true},
Cgwh: &customGinWrap{},
Acwh: &assembleCustomWrap{isEnable: true},
Cver: &validatorErrorRes{isEnable: true},
Cp: &serverContextPath{isEnable: true}}
// 设置根路径
ExtendsRegisterDefault.Cp.SetContextPath(rootPath)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。