-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate structs of database views #52
Comments
Hi @erojano! Yes this is a good one and makes sense to me, I'm totally in for that! Do you want to give it a try? I'm not sure if I can find time for adding this in near future. |
Yeah, I'll be happy to contribute; I just have to make some time. |
Need it too! Will it be implemented? |
I'm afraid it is not as easy as it looks like. At least for MySQL I checked real quick on how to get the column definitions and it seems all we can get here is the CREATE statement the view was created with - https://dev.mysql.com/doc/refman/8.0/en/information-schema-views-table.html Same applies for PG: https://www.postgresql.org/docs/current/view-pg-views.html It seems it boils down to be the same request as in #1 - parsing a SELECT-query string to create the table&column definitions from it rather than querying INFORMATION_SCHEMA tables. This would require a sophisticated SQL parser I'm open to discuss the options, but not sure if I can find time to actively implement it. |
I need this kind of feature for my other project, so I have created https://github.com/mpkondrashin/views and used it to generate https://github.com/mpkondrashin/smsdb this code is not fully tested, it is PoC, I would say, but it shows that generating go structures for MySQL views is possible. |
This is a kind feature request :)
Is there any way of generate structs also of database views?
Thank you.
The text was updated successfully, but these errors were encountered: