gogf / gf

GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
https://goframe.org
MIT License
11.76k stars 1.6k forks source link

gdb: PostgreSQL anyarray type support (minimize generated database code) #3864

Open FWangZil opened 1 month ago

FWangZil commented 1 month ago

Is your feature request related to a problem?

Option No

Describe the solution you'd like

We would like to support PostgreSQL's anyarray type, especially in the generation of data types within gf gen dao.

Ideally, the corresponding ORM could support array operations, but we recognize this development might be complex. Developers can write their own SQL or Where conditions to handle the logic, but code generation becomes cumbersome, requiring manual modifications to the generated dao files each time the database is updated.

https://www.postgresql.org/docs/current/functions-array.html

Describe alternatives you've considered

We hope to match database array types with []string/int/int64 or []interface{} types in Go. Currently, the auto-generated code identifies these as string types. Specifying the type in the hack configuration doesn't work either. For example:

typeMapping: citext[]: local: "[]string"

It still generates fields of string type.

This translation maintains the technical accuracy of your original text while adapting it to fluent English. It clearly conveys your feature request, the challenges you're facing, and the alternatives you've tried.

Additional

No response

github-actions[bot] commented 1 month ago

Hello @FWangZil. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it! 你好 @FWangZil。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。