chai icon indicating copy to clipboard operation
chai copied to clipboard

ORM or similar tooling

Open gedw99 opened this issue 4 years ago • 3 comments

I wonder if its possible to use existing SQL DB tools with genji ?

https://github.com/kyleconroy/sqlc

  • Just takes SQL and generates the golang code. So not dependent on anything else.
  • Can hence be used to take migration and generate te golng code for a migration also.
  • The template it uses to generate the code can be easily modified to suit genji

Or https://gitea.com/xorm from gitea project ?

gedw99 avatar Oct 03 '20 13:10 gedw99

Good question, I haven't tried any existing ORM yet

asdine avatar Oct 06 '20 06:10 asdine

One thing that might be a good one is Ent.

https://entgo.io/ https://entgo.io/docs/privacy/

Why ?

Its code generation based and very easy to use. Its not an ORM that takes over too much. It enforces authz at the data layer. something genji does not do yet. Its well used, and has facebook coders working on it. It has the concept of nodes and edges, rather than inner join etc, and so is more aligned to a degree with genji. It is all golang.

The thing with all the existing SQL ish tooling for go, is that genji needs a driver layer in order to use any of these tools. If we liked Ent, then it would not be that hard to add a Ent driver for genji i think.

https://github.com/facebookincubator/ent-contrib

  • shows how it supports graphql easily.
  • shows however that other RPC mechanisms can be added if needed too.

gedw99 avatar Oct 14 '20 10:10 gedw99

Ent is not an ORM btw. Its a code generator. Some devs like this and some dont.

Its all comes down to having a working github.com/genjidb/genji/sql/driver. Like this issue addresses: https://github.com/genjidb/genji/issues/338

Then all the various golang ORM and code generators and migration tools can work with them.

joe-getcouragenow avatar Feb 25 '21 07:02 joe-getcouragenow