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

Refactor SQL storage layer using ORM #1864

Open
4 of 7 tasks
nabokihms opened this issue Nov 15, 2020 · 7 comments
Open
4 of 7 tasks

Refactor SQL storage layer using ORM #1864

nabokihms opened this issue Nov 15, 2020 · 7 comments

Comments

@nabokihms
Copy link
Member

nabokihms commented Nov 15, 2020

Is your feature request related to a problem? Please describe.
Refactoring of SQL level was previously suggested here -
#1831 (comment)

Describe the solution you'd like to see
Back in the days, there weren't fully statically typed convenient ORMs for golang. Now we have such a tool - ent from Facebook. The main advantages are:

  1. Query constructor
  2. Migration
  3. Static types

Describe alternatives you've considered
Leave SQL storage layer as is.

Additional context
I wonder, is it ok to start working on this one? Ent is lovely, we use it for a couple of projects. @sagikazarmark Have you already started working on this?

Roadmap:

@al45tair
Copy link
Contributor

It'd be nice to get my middleware changes in first :-) (See #1841.)

Otherwise, there's going to be quite a lot to change in that patch.

@sagikazarmark
Copy link
Member

sagikazarmark commented Nov 16, 2020

I think that's a great idea. I'm actually looking at it for quite some time now, but always lacked the time to implement it. I think ent is a great choice, although I don't have a lot of experience with it other than a few simple applications. It's probably the first decent ORM for Go, at least I have terrible experience with basically all other Go ORMs.

@al45tair I would assume that this storage driver would actually be a new one, not a rewrite of the existing ones. Do you think that would still affect your PR negatively?

@al45tair
Copy link
Contributor

@sagikazarmark It's not so much that it'll affect it negatively; rather, if this is done first, it'll mean I've got to work out how to extend the new storage driver as well. It's OK, as long as it's clear enough what to do :-)

And you're right, if it's a new storage driver, it won't have too much of a negative impact.

@nabokihms
Copy link
Member Author

Maybe we could also generate the grpc API code from the ent schema as well
https://entgo.io/blog/2021/06/28/gprc-ready-for-use/

/cc @sagikazarmark

@sagikazarmark
Copy link
Member

Not a huge fan of the idea. I don't really like binding the storage layer to the API or the transport.

@sagikazarmark
Copy link
Member

What's the state of this @nabokihms ? I believe most of the implementation is done, right?

@nabokihms
Copy link
Member Author

The only step left is to provide and test the migration. I haven't had time to work on this one.

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

3 participants