英文:
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的模块化程度更高。
你可以使用goforms或gorilla/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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论