You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just playing around with Sequel and PostgreSQL for the purpose of staying on PORO as long as I can, I have designed a sort of simplified ORM and decided to share it here.
It's quite straightforward - entity -> mapper -> PG -> builder -> entity and it requires creating mappers for an entity to be stored; but mappers are simple.
Article=Struct.new(:id,:title,keyword_init: true)classArticleMapper < MapperklassArticleinto:articlesproperties:id,:titleend# not required for a such simple entity where enough Article.new(**payload)classArticleBuilder < BuilderklassArticlefrom:articlesproperties:id,:titleend
Hope you find it interesting. There are missed ObjectFromHash and ObjectToHash classes inside the archive, but I think those names speak for the purpose.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Just playing around with Sequel and PostgreSQL for the purpose of staying on PORO as long as I can, I have designed a sort of simplified ORM and decided to share it here.
It's quite straightforward -
entity -> mapper -> PG -> builder -> entity
and it requires creating mappers for an entity to be stored; but mappers are simple.Hope you find it interesting. There are missed ObjectFromHash and ObjectToHash classes inside the archive, but I think those names speak for the purpose.
sort-of-orm.zip
Beta Was this translation helpful? Give feedback.
All reactions