-
Notifications
You must be signed in to change notification settings - Fork 37
JSON in types #46
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
JSON in types #46
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ object PostgresClient { | |
|
||
case class TypeSpecifier(receiveFunction: String, typeName: String, elemOid: Long = 0) | ||
|
||
private[finagle] val defaultTypes = Map( | ||
val defaultTypes = Map( | ||
Types.BOOL -> TypeSpecifier("boolrecv", "bool"), | ||
Types.BYTE_A -> TypeSpecifier("bytearecv", "bytea"), | ||
Types.CHAR -> TypeSpecifier("charrecv", "char"), | ||
|
@@ -95,6 +95,7 @@ object PostgresClient { | |
Types.TID -> TypeSpecifier("tidrecv", "tid"), | ||
Types.XID -> TypeSpecifier("xidrecv", "xid"), | ||
Types.CID -> TypeSpecifier("cidrecv", "cid"), | ||
Types.JSON -> TypeSpecifier("json_recv", "json"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general I've tried to only include types in the default map that are baked-in to postgres without installing an extension. I think that's now the case for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JSON was added as a baked-in feature in Postgres 9.2 (released in 2012, so it's pretty likely that most people are on at least that version at this point). |
||
Types.XML -> TypeSpecifier("xml_recv", "xml"), | ||
Types.POINT -> TypeSpecifier("point_recv", "point"), | ||
Types.L_SEG -> TypeSpecifier("lseg_recv", "lseg"), | ||
|
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.
Why does it need to be public?
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'm making it public to make things slightly easier for the next person who finds that one of the types they use isn't part of
defaultTypes
and who doesn't want to use the fatally-bugged dynamic-type-map-building feature. Right now, if you want to usewithCustomTypes
, chances are that you'll have to copy this definition ofdefaultTypes
into your code so you can have aMap
that adds the mappings you need to pass towithCustomTypes
.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 say it's "fatally-bugged" because the
Future
here caches any failure to pull the typeMap at startup forever, thus borking the client)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.
Reading these comments again, I think my tone may be slightly abrasive. Sorry about that!