-
Notifications
You must be signed in to change notification settings - Fork 56
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
Encoded values as Params? #48
Comments
I agree this might be useful to some. However I'd rather go with the following: raw :: Value (LibPQ.Oid, Maybe ByteString) Then the definition of your I won't promise to implement that soon, though. A PR would be welcome. |
If we go with |
Right. Actually it seems like our both variants are impossible. What we can do is something more like this: -- | Given an OID and an according array OID
-- produces an encoder of raw bytes.
raw :: Oid -> Oid -> Value (Maybe ByteString) |
How about this? rawList :: Params [(LibPQ.Oid, Maybe ByteString)]
rawList = Params (Params.Params $ Op encoder)
where
encoder = DList.fromList . map (fmap const) |
Or rather rawList :: Params [(LibPQ.Oid, Bool -> Maybe ByteString)]
rawList = Params (Params.Params $ Op DList.fromList) |
Oh, right! This you can do. Can you describe your use-case though? Maybe we could find something better than exporting such a low-level functionality. |
I work on a compiler which converts a JSON based query language to SQL. In a nutshell, exec :: DatabaseSchema -> JSONQuery -> IO (Either Error Aeson.Value) So, given a query, a Postgres prepared statement is generated, and with the I would like to replace this wrapper with |
It is useful when dealing with dynamically generated queries.
The text was updated successfully, but these errors were encountered: