该操作需登录 Gitee 帐号,请先登录后再操作。 立即登录 没有帐号,去注册 编辑仓库简介 简介内容 https://github.com/go-playground/validator 主页 取消 保存更改 Go 1 https://gitee.com/golang_yi/validator.git git@gitee.com:golang_yi/validator.git golang_yi validator validator master深圳...
go get github.com/go-playground/validator 代码 package main import ( "fmt" "github.com/go-playground/validator" ) var validate *validator.Validate //定义 type User struct { Name string `validate:"required"` //非空 Age uint8 `validate:"gte=0,lte=130"` // 0<=Age<=130 ...
eggper5楼•3 个月前
可见这真的是一个更好的 Playground,一定程度上有点在线编辑器的感觉。该项目在 GitHub 的地址:https://github.com/x1unix/go-playground。后记 除了以上三款,其实还有一些其他的,比较小众,因此不做对比。最后,推荐大家以后可以使用 https://goplay.tools/,有兴趣的也可以为它贡献代码。参考资料 [1]Go Pl...
"github.com/gin-gonic/gin" ut "github.com/go-playground/universal-translator" val "github.com/go-playground/validator/v10" "strings" ) type ValidError struct { Key string Message string } type ValidErrors []*ValidError func (v *ValidError) Error() string { return v.Mess...
这个界面和官方的 Playground 基本类似,但多了一个 Options。这个功能来自作者的另一个项目:https://github.com/syumai/go-playground-custom,好吧,又一个 Playground。这个项目的目标是为 Playground 提供一些额外的特性,包括:基于 CodeMirror 的丰富编辑器;语法高亮(官方 Playground 是不支持语法高亮的);Vim...
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.
packagemainimport("io"stdlog"log""github.com/go-playground/errors/v5""github.com/go-playground/log/v8")funcmain() {log.RedirectGoStdLog(true)// Tracedeferlog.WithTrace().Info("time to run")log.Debug("debug")log.Info("info")log.Notice("notice")log.Warn("warn")log.Error("error")/...
不过可惜的是,这么好的工具在国内是无法访问的。于是,我抽空在阿里云主机上搭建了个人版The Go Playground,网址为https://play.yeyuqiu.com,供大家学习交流使用。 Playground官方版的搭建教程很简单,但是需要fq才能搭建成功。大家如果也想搭建自己的Playground,可以参考我的方法,详见https://github.com/yeyuqiu/playgro...
[1] 官方Go Playground 项目: github.com/golang/playg[2] 可以自取: github.com/soulteary/go[3] 下载安装文件: docker.com/get-started/[4] 更简单的 Docker 安装: soulteary.com/2022/06/2[5] 这篇官方博客: blog.go-zh.org/playgrou 如果你觉得内容还算实用,欢迎点赞分享给你的朋友,在此谢过。