You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
496 B

package args
import "errors"
type LoginReq struct {
Account string `json:"account"`
Password string `json:"password"`
}
func (arg LoginReq) Validate() (err error) {
if len(arg.Account) == 0 {
err = errors.New("account is empty")
return
}
if len(arg.Account) > 36 {
err = errors.New("account length must be at most 36")
return
}
if len(arg.Password) < 6 || len(arg.Password) > 128 {
err = errors.New("password length must be at least 6 and at most 128")
return
}
return
}