V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  qh666  ›  全部回复第 1 页 / 共 1 页
回复总数  3
310 天前
回复了 glaz 创建的主题 程序员 单用户余额高并发支出收入有啥好方案?
@sujin190 标题说的 一个商户一秒一千笔收入记录和一千笔支出记录 24x60x60x1000x2 不就是 1.7 亿多么
2024-07-19 15:00:34 +08:00
回复了 Geekerstar 创建的主题 Java javafx 打包 exe 问题
gopher 看到这种问题太爽了
使用 https://github.com/go-playground/validator 校验即可
类似于这种接第三方 api 的应用推荐使用
github.com/go-resty/resty

个人建议是早期先引入此类成熟的工具库,否则后期不好改动,只能硬着头皮去维护了

参考

validated.BindAndValidatePostJson()

type LoginReq struct {
Phone string `json:"phone" binding:"omitempty,required_if=Type 1,required_if=Type 2,phone,len=11"` // 手机号
Type int `json:"type" binding:"required,oneof=1 2 3 4"` // 1 短信验证码登录 2 账号密码登录
}
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3082 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 11:28 · PVG 19:28 · LAX 04:28 · JFK 07:28
Developed with CodeLauncher
♥ Do have faith in what you're doing.