-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PG::RecordCoder for en/decoding of Composite Types #36
Conversation
I'm looking forward to this feature! |
602e570
to
44578ba
Compare
07d353a
to
b758fa2
Compare
This implements proper encoder and decoder for Composite Types as described in https://www.postgresql.org/docs/11/rowtypes.html and as requested in https://bitbucket.org/ged/ruby-pg/issues/258 This adds the following classes: * PG::RowCoder < PG::Coder * PG::RowEncoder < PG::RowCoder * PG::RowDecoder < PG::RowCoder * PG::TextEncoder::Row < PG::RowEncoder * PG::TextDecoder::Row < PG::RowDecoder Fixes ged#258
I think this makes the purpose of the en/decoder more clear and distances from CopyRow coders. So this renames the classes to these: * PG::RecordCoder < PG::Coder * PG::RecordEncoder < PG::RecordCoder * PG::RecordDecoder < PG::RecordCoder * PG::TextEncoder::Record < PG::RecordEncoder * PG::TextDecoder::Record < PG::RecordDecoder
... and add documentation to record encoder and decoder.
@ged After almost 3 years of development this is now ready to be reviewed and merged. I accidentally already pushed this patches into the bitbucket default branch and don't know how to remove it from there. If this PR is OK to merge I'll sync github and bitbucket again. |
It is internal only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't wait to try this out. I have a project coming up that I'm planning on using this for.
This implements proper encoder and decoder for Composite Types as described in https://www.postgresql.org/docs/11/rowtypes.html and as requested in https://bitbucket.org/ged/ruby-pg/issues/258
This adds the following classes:
I first took
PG::RowCoder
as class name, due to theROW(...)
expression provided by PostgreSQL. However this is changed in the second commit, since "Row" is too generic in my opinion and could lead to confusion withCopyRow
. So I think "Record" expresses this type of data best.Unfortunately the names
PG::CompositeCoder
,PG::CompositeDecoder
andPG::CompositeEncoder
are already in use (since pg-0.18.0). They should have been namedPG::ArrayCoder
instead, but now it's probably too late to change them, since they have been released years ago. Actually I doubt thatPG::CompositeCoder
etc. are in use in any external code, but I don't want to break the API for the sake of consistency.