golobby/orm

Rename to ORM

miladrahimi opened this issue · 2 comments

I think it's an ORM package, a data mapper one!
It maps data from database to structs and it can also extended to persist data from structs into databases.
So it should be renamed to "orm"!
Or if change o (object) to s (struct), it could have a funny name, "srm"!

I think of it more as a toolbox, since it's actually built with two almost seperate packages and they can both be used seperately, I agree with you that the bind package is basically an ObjectMapper but I don't see this as a unified ORM, We can turn it into an ORM but I think that way we need to talk about what we want from an ORM ( api, transactions, change tracker, ...), this way things are much simpler, if we want ORM we need to talk about the design and also some other features that are needed.

@miladrahimi after some investigation into other ORMs ( ef core, eloquent, django ORM) I think we can make a decent ORM out of this package.
My plan is:

  • Using startup time reflection to generate a schema for tables that later we use when querying an object.
  • Anywhere possible we should define an optional interface that user can implement if he/she wants to change the default behaviour.
    Take a look at the master branch now into the orm.go file and tell me what other APIs we need, after all you are a master when it comes to API design :))