graphiti
graphiti copied to clipboard
Added an analogue ActiveRecord adapter for Sequel
Hi, this is my attempt to add an adapter for Sequel with functionality similar to ActiveRecord. From the disadvantages of the adapter I will note several items:
- No support for aliases, I haven't found analog of
attribute_alias
for Sequel - I don't fully understand what
#associate_all
and#associate does
forActiveRecord
adapter, maybe my implementation doesn't quite fit as an analogue. -
Kaminari
doesn't supportSequel
, for that reason I used an implementation from theSequel
extension that doesn't support analog of padding. - Perhaps Sequel
#disconnect
does not do the same as ActiveRecord#clear_active_connections!
Hey @AlexeyMatskevich sorry for the delay, I've had 👀 on this for a while but haven't commented. Great work. Very, very cool to see ❤️
Re: associate/associate_all
- basically only there because AR will hit the DB as a side effect when using plain accessor logic, you might now need anything here.
Past that, I think this probably makes the most sense as a separate gem. I'd be happy to put it in the graphiti-api
org and/or link to it on the documentation website, though.
Specs are the last thing. It'd be nice to have a kind of "adapter spec suite" we could run to validate an adapter works. Too bad we don't have that right now, but some sort of testing would be good.
Again, this was great to see!
Hey @richmolj I could try writing specifications for an ActiveRecord adapter to use this test set afterwards to compare the capabilities of the adapter for Seqeul with the standard adapter (ActiveRecord). Then wee can take a look at the overall code and put the tests for AR in a separate pull request and the code of adapter for Sequel with tests in a separate gem.