Skip to content
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

Make view/table generator optional #107

Open
AlekSi opened this issue Feb 10, 2017 · 1 comment
Open

Make view/table generator optional #107

AlekSi opened this issue Feb 10, 2017 · 1 comment

Comments

@AlekSi
Copy link
Member

AlekSi commented Feb 10, 2017

Sometimes we want to generate code only for Struct/Record, and not for View/Table. For example, see this reform-db model.

In a magic comment, table name - (as in //reform:-) should generate Struct/Record, but skip View/Table code.

@uzzz
Copy link

uzzz commented Nov 17, 2020

I wanted to help with this task, so I checked the code and it appears that it's not that easy: interface Struct has View() View method (

reform/base.go

Line 62 in e66d963

View() View
), so the generation of the view cannot just be skipped without API changes.

As soon as NextRow does not actually need .View() the possible solution could be is to split Struct interface into two: "pure struct" and "struct with a view", that embeds "pure struct" and adds .View() and then change the signature of NextRow() (naming is something that needs discussion).

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants