Go语言中的WTForms等效库是什么?

huangapple go评论95阅读模式
英文:

WTForms equivalent for Go?

问题

我目前正在使用Flask、WTForms、SQLAlchemy以及相应的Flask扩展来开发一个应用程序。我考虑将来转向使用Go语言,因为某些原因。在Go语言中是否有任何库可以像WTForms一样将Web表单映射到模型并进行参数化验证?

英文:

I am currently developing an application using Flask, WTForms, SQLAlchemy and the corresponding Flask extensions to glue them all together. I am considering moving to Go in the future because reasons. Are there any libraries in Go that allow me to map web forms to models and parameterise validation the same way WTForms does?

答案1

得分: 6

目前还没有像WTForms一样完整的Go表单处理库,你会发现Go的包比Flask的模块化程度更高。

你可以使用goformsgorilla/schema将POST表单转换为Go结构体。

我还推荐使用sqlx作为database/sql的一个很好的扩展。

英文:

There is not something as "complete" as WTForms for Go (yet): you will find that Go packages are a little more modular than even Flask's.

You can cover the POST form to Go struct with either goforms or gorilla/schema.

I'd also recommend sqlx as a nice shim on top of database/sql.

huangapple
  • 本文由 发表于 2014年3月27日 18:31:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/22684830.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定