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

proposal: gen the DB #157

Open
ghost opened this issue Feb 14, 2019 · 3 comments
Open

proposal: gen the DB #157

ghost opened this issue Feb 14, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Feb 14, 2019

THis is a really great project. I have been working on something similar, but i think i will swap to yours.

I was wondering if you think using sqlboiler ( github.com/volatiletech/sqlboiler ) to gen the DB makes sense ?
I noticed that you gen the Standard CRUD Methods and so it seems a pretty good idea to then do the same for the DB.

There is always a imbalance, for want of a better word, between what your DB model looks like and what your GRPC model looks like. Hope you know what i mean ?
SO for now, if you think this is a good idea, then the developer has to write code in the middle to get the data from the DB that he / she needs to fulfil the Protobuf API.

In the past i wrote a very large code generator that is quite a bit like this.
In order to help with the "imbalance" we created a mapping between the protobuf and the db tables, to help do more codegen. But i think thats much later..

anyways, eager to hear what your think.

@fi0
Copy link
Contributor

fi0 commented Mar 14, 2019

something similar to https://github.com/infobloxopen/protoc-gen-gorm but for sqlboiler instead of gorm?

@l4u
Copy link
Contributor

l4u commented Mar 16, 2019

It would be nice for a grapi db plugin. This shouldn't be added in the grapi core to avoid bloats.

@ghost
Copy link
Author

ghost commented Mar 16, 2019

@fi0 yes exactly. github.com/volatiletech/sqlboiler is much faster since it does not use reflection.
The benchmarks show a 5 to 10 times speed up
https://github.com/volatiletech/sqlboiler#benchmarks

@l4u makes sense. SQL boiler is a db schema first generator. I think we can gen the schema from the protobufs but not sure right now. any ideas ?
EDIT: just saw that https://github.com/infobloxopen/protoc-gen-gorm uses meta data added to the protobufs to infer the database. Seems very smart as i like the idea of it all being in the protobufs.
Is this a problem for grapi ?

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

No branches or pull requests

2 participants