The project initially started when I’m looking for an alternate orm that able to identify whether a struct field should be updated or should be ignored. this problem occurs especially if the struct comes from JSON, and only some field needs to be updated, one way to solve it is to ignore all zero value, but It’s not a very elegant solution, since we’ll loose the ability to set value to zero.
What is it?
Grimoire is a database access layer inspired by Ecto. It features a flexible query API and built-in validation. It currently supports MySQL, PostgreSQL, and SQLite3 but a custom adapter can be implemented easily using the Adapter interface.
Common go ORM accepts struct as a value for modifying records which has a problem of unable to differentiate between an empty, nil, or undefined value. It’s a tricky problem especially when you want to have an endpoint that supports partial updates. Grimoire attempts to solve that problem by integrating Changeset system inspired from Elixir’s Ecto. Changeset is a form like entity which allows us to not only solve that problem but also help us with casting, validations, and constraints check.
It would be great to hear feedback about this project, Thank you!