Documentation ¶
Index ¶
- type ChangePasswordRequest
- type ChangePasswordResponse
- type DeleteRequest
- type DeleteResponse
- type GetRequest
- type GetResponse
- type LoginRequest
- type LoginResponse
- type LogoutRequest
- type LogoutResponse
- type RegisterRequest
- type RegisterResponse
- type UpdateRequest
- type UpdateResponse
- type User
- type UserAddress
- type UserRole
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangePasswordRequest ¶
type ChangePasswordRequest struct { OperatorID uint `json:"operatorId" validate:"required"` ID uint `json:"id" validate:"required"` Password string `json:"password" validate:"required,min=6,max=16"` PasswordNew string `json:"passwordNew" validate:"required,min=6,max=16,eqfield=Password"` }
func (*ChangePasswordRequest) Validate ¶ added in v1.0.11
func (r *ChangePasswordRequest) Validate(v *validator.Validate) error
type ChangePasswordResponse ¶
type ChangePasswordResponse struct {
Message string `json:"message" validate:"required"`
}
func (*ChangePasswordResponse) Validate ¶ added in v1.0.11
func (r *ChangePasswordResponse) Validate(v *validator.Validate) error
type DeleteRequest ¶
type DeleteRequest struct { OperatorID uint `json:"operatorId" validate:"required"` ID uint `json:"id" validate:"required"` }
func (*DeleteRequest) Validate ¶ added in v1.0.11
func (r *DeleteRequest) Validate(v *validator.Validate) error
type DeleteResponse ¶
type DeleteResponse struct {
Message string `json:"message" validate:"required"`
}
func (*DeleteResponse) Validate ¶ added in v1.0.11
func (r *DeleteResponse) Validate(v *validator.Validate) error
type GetRequest ¶ added in v1.0.20
type GetRequest struct { OperatorID uint `json:"operatorId" validate:"required"` ID uint `json:"id" validate:"required"` }
操作带上 OperatorID,可用于检查操作者与被目标对象之间的关系,用于权限控制
func (*GetRequest) Validate ¶ added in v1.0.20
func (r *GetRequest) Validate(v *validator.Validate) error
type GetResponse ¶ added in v1.0.20
type GetResponse struct { ID uint `json:"id" validate:"required"` NickName string `json:"nickName"` CreatedAt int64 `json:"createAt"` Email string `json:"email" validate:"required,email"` Telephone string `json:"telephone"` Address UserAddress `json:"address"` Role UserRole `json:"role"` Credits int `json:"credits" validate:"gte=0"` Level int `json:"level" validate:"gte=0"` Age uint `json:"age" validate:"gte=0,lte=130"` Birthday int64 `json:"birthday"` Message string `json:"message" validate:"required"` }
func (*GetResponse) Validate ¶ added in v1.0.20
func (r *GetResponse) Validate(v *validator.Validate) error
type LoginRequest ¶
type LoginRequest struct { Email string `json:"email" validate:"required,email"` Password string `json:"password" validate:"required,min=6,max=16"` IP string `json:"ip" validate:"ip"` }
Login request swagger:model
func (*LoginRequest) Validate ¶ added in v1.0.10
func (r *LoginRequest) Validate(v *validator.Validate) error
type LoginResponse ¶
type LoginResponse struct { ID uint `json:"id" validate:"required"` Token string `json:"token" validate:"required"` ExpiresAt int64 `json:"expiresAt" validate:"required"` Message string `json:"message" validate:"required"` }
Login response swagger:model
func (*LoginResponse) Validate ¶ added in v1.0.11
func (r *LoginResponse) Validate(v *validator.Validate) error
type LogoutRequest ¶
type LogoutRequest struct { ID uint `json:"id" validate:"required"` IP string `json:"ip" validate:"ip"` }
Logout request swagger:model
func (*LogoutRequest) Validate ¶ added in v1.0.11
func (r *LogoutRequest) Validate(v *validator.Validate) error
type LogoutResponse ¶
type LogoutResponse struct {
Message string `json:"message" validate:"required"`
}
Logout response swagger:model
func (*LogoutResponse) Validate ¶ added in v1.0.11
func (r *LogoutResponse) Validate(v *validator.Validate) error
type RegisterRequest ¶ added in v1.0.8
type RegisterRequest struct { Email string `json:"email" validate:"required,email"` Password string `json:"password" validate:"required,min=6,max=16"` }
func (*RegisterRequest) Validate ¶ added in v1.0.10
func (r *RegisterRequest) Validate(v *validator.Validate) error
type RegisterResponse ¶ added in v1.0.8
type RegisterResponse struct {
Message string `json:"message" validate:"required"`
}
func (*RegisterResponse) Validate ¶ added in v1.0.11
func (r *RegisterResponse) Validate(v *validator.Validate) error
type UpdateRequest ¶
type UpdateRequest struct { OperatorID uint `json:"operator-id" validate:"required"` ID uint `json:"id" validate:"required"` NickName string `json:"nickName"` Address UserAddress `json:"address"` Telephone string `json:"telephone"` Birthday int64 `json:"birthday"` }
func (*UpdateRequest) Validate ¶ added in v1.0.10
func (r *UpdateRequest) Validate(v *validator.Validate) error
type UpdateResponse ¶
type UpdateResponse struct {
Message string `json:"message" validate:"required"`
}
func (*UpdateResponse) Validate ¶ added in v1.0.11
func (r *UpdateResponse) Validate(v *validator.Validate) error
type User ¶ added in v1.0.8
type User struct { gorm.Model // Username string `json:"username" gorm:"comment:用户登录名" validate:"required,min=6,max=16"` Email string `json:"email" gorm:"comment:用户邮箱" validate:"required,email"` NickName string `json:"nickName" gorm:"default:追梦小喵;comment:用户昵称"` Password string `json:"password" gorm:"comment:用户登录密码" validate:"required,min=6,max=16"` Address UserAddress `json:"address" gorm:"comment:用户地址;foreignkey:ID;references:id"` Role UserRole `json:"role" gorm:"comment:用户角色"` Credits int `json:"credits" gorm:"comment:用户积分" validate:"gte=0"` Birthday time.Time `json:"birthday" gorm:"comment:用户生日;type=date" validate:"required"` Telephone string `json:"telephone" gorm:"comment:用户手机号"` }
type UserAddress ¶ added in v1.0.11
Click to show internal directories.
Click to hide internal directories.