Versions in this module Expand all Collapse all v1 v1.1.1 May 6, 2026 v1.1.0 May 3, 2026 v1.0.0 Apr 4, 2026 v0 v0.4.0 Mar 24, 2026 v0.0.4 Mar 19, 2026 v0.0.3 Mar 2, 2026 Changes in this version + const CodeForbidden + const CodeInternalError + const CodeInvalidParam + const CodeUnauthorized type Result + func Forbidden() Result + func InternalError() Result + func InvalidParam(msg string) Result + func Unauthorized() Result v0.0.2 Jan 24, 2026 v0.0.1 Dec 8, 2025 Changes in this version + const CodeError + const CodeSuccess + const CodeWarning + var CodeMessage = map[int]string + var ErrInvalidToken = errors.New("无效的令牌") + var ErrNoResponse = errors.New("不需要返回响应") + var ErrSessionExpired = errors.New("会话已过期") + var ErrSessionNotFound = errors.New("会话不存在") + var ErrUnauthorized = errors.New("未授权") + func BS[Req any](fn func(ctx *gctx.Context, req Req, sess session.Session) (Result, error)) gin.HandlerFunc + func B[Req any](fn func(ctx *gctx.Context, req Req) (Result, error)) gin.HandlerFunc + func GetCodeMessage(code int) string + func IsPassword(password string) bool + func IsStrongPassword(password string) bool + func S(fn func(ctx *gctx.Context, sess session.Session) (Result, error)) gin.HandlerFunc + func W(fn func(ctx *gctx.Context) (Result, error)) gin.HandlerFunc + type CompositeRule struct + func (r *CompositeRule) Validate(value any) error + type Context = gctx.Context + type CustomRule struct + func (r *CustomRule) Validate(value any) error + type EmailRule struct + func (r *EmailRule) Validate(value any) error + type EqualsRule struct + func (r *EqualsRule) Validate(value any) error + type FieldValidator struct + func NewFieldValidator(fieldName string, value any) *FieldValidator + func (fv *FieldValidator) AddRule(rule ValidationRule) *FieldValidator + func (fv *FieldValidator) Validate() []string + type Handler interface + PrivateRoutes func(server *gin.Engine) + PublicRoutes func(server *gin.Engine) + type InRule struct + func (r *InRule) Validate(value any) error + type LengthRangeRule struct + func (r *LengthRangeRule) Validate(value any) error + type MaxLengthRule struct + func (r *MaxLengthRule) Validate(value any) error + type MinLengthRule struct + func (r *MinLengthRule) Validate(value any) error + type MobileRule struct + func (r *MobileRule) Validate(value any) error + type PageData struct + List []T + Page int + Size int + Total int64 + type PageRequest struct + Page int + Size int + func (p *PageRequest) Offset() int + func (p *PageRequest) Validate() + type PatternRule struct + func (r *PatternRule) Validate(value any) error + type RangeRule struct + func (r *RangeRule) Validate(value any) error + type RequiredRule struct + func (r *RequiredRule) Validate(value any) error + type Result struct + Code int + Data any + Msg string + func Error(msg string) Result + func ErrorWithCode(code int, msg string) Result + func Success(msg string, data any) Result + func Warning(msg string, data any) Result + type URLRule struct + func (r *URLRule) Validate(value any) error + type ValidationRule interface + Validate func(value any) error + func And(rules ...ValidationRule) ValidationRule + func ChineseName() ValidationRule + func Custom(validateFunc func(value any) error) ValidationRule + func CustomCondition(condition bool, errMsg string) ValidationRule + func Email() ValidationRule + func Equals(compareValue any) ValidationRule + func IDCard() ValidationRule + func In(options ...string) ValidationRule + func LengthRange(min, max int) ValidationRule + func MaxLength(max int) ValidationRule + func MinLength(min int) ValidationRule + func Mobile() ValidationRule + func Password() ValidationRule + func Pattern(pattern string, errMsg ...string) ValidationRule + func Range(min, max int) ValidationRule + func Required() ValidationRule + func StrongPassword() ValidationRule + func URL() ValidationRule + func Username() ValidationRule + type ValidatorBuilder struct + func NewValidatorBuilder() *ValidatorBuilder + func (vb *ValidatorBuilder) Field(fieldName string, value any) *FieldValidator + func (vb *ValidatorBuilder) GetErrorString() string + func (vb *ValidatorBuilder) GetErrors() []string + func (vb *ValidatorBuilder) GetFirstError() string + func (vb *ValidatorBuilder) IsValid() bool + func (vb *ValidatorBuilder) Validate() *ValidatorBuilder