guardian icon indicating copy to clipboard operation
guardian copied to clipboard

Removing ORM and moving from Gorm to vanilla sql

Open mabdh opened this issue 2 years ago • 2 comments

Summary For some basic CRUD, ORM is helpful and help us faster in development. However, in our current state of Guardian, there are some cases when using gorm as an ORM will overcomplicate the query since we need more advanced query.

Proposed solution We can remove the ORM to get more flexibility to build a query and use query builder (goqu, squirrel, etc) instead to help it.

mabdh avatar Aug 02 '22 07:08 mabdh

If later we decided to do this, I vote for working on https://github.com/odpf/guardian/issues/242 first before working on this issue, so that we can have more confidence on the tests after having big changes for this

rahmatrhd avatar Aug 02 '22 09:08 rahmatrhd

@rahmatrhd +1 for that

mabdh avatar Aug 02 '22 09:08 mabdh

based on our discussion, since the current PR for this issue adds more complexity to the code (scanning models with o2o, o2m, and m2m relationships can't be straightforward when not using gorm, a lot of custom raw query as a workaround to the previously mentioned issue) over improving readability, we will keep gorm for guardian, while still on improving some slow query/bad readability code/etc.

rahmatrhd avatar Oct 21 '22 06:10 rahmatrhd