Fix HSTORE encoding by using pg-hstore library.#695
Fix HSTORE encoding by using pg-hstore library.#695durango merged 3 commits intosequelize:masterfrom twg:master
Conversation
|
This is in relation to Issue#692. |
|
Could you fix up the specs/tests? And I created the hstore functionality for sequelizejs. Taking a quick glance at: https://github.com/scarney81/pg-hstore/blob/master/lib/index.js the only advantage that I see is the "advanced" types: https://github.com/scarney81/pg-hstore/blob/master/test/parse.js#L45 I wish they provided tests by spacing out their characters. If you could throw more tests in (and make sure spacing is OK) I'll merge this and eventually remove my .toHstore function. Good find :) |
|
The
A simple test is: Can you store and retrieve a JSON stringified object that's intentionally abusive like |
No, but at the time I also didn't know of any decent libraries (even after a Google search) and I simply did not have the time to write something else. As I said, I'm far more than welcoming this patch :) Would like to see some tests though since it will do two things:
Makes sense? |
|
I'm having a look a the tests for this feature and will try and adapt them to expose this problem, and also apply the |
|
@tadman awesome and thanks! :) Will keep a close eye on this PR. If you use IRC at all, join us at #sequelizejs on freenode. We need more postgres people hah. |
|
;) @durango is this good to merge? |
Fix HSTORE encoding by using pg-hstore library.
The work involved in properly encoding an HSTORE attribute is surprisingly complicated, but the pg-hstore library does a good job of implementing it correctly.
That project is MIT licensed, so it should be possible to internalize the relevant code inside Sequelize and give credit to the original author.