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 support for named parameters #49

ChShersh opened this Issue Oct 11, 2018 · 0 comments


None yet
1 participant
Copy link

ChShersh commented Oct 11, 2018

This is very convenient feature. It's present in sqlite-simple package.

Consider the following query:

    updateUploadHistory :: UTCTime -> m ()
    updateUploadHistory curTime = executeNamed_ [sql|
        INSERT INTO file_upload_history
            (file_name, uploader_id, timestamp, data_type, remarks)
            (:file, :uploader, :time, :type, :remarks)
        |] [ ":file"     := duFileName
           , ":uploader" := adminId
           , ":time"     := curTime
           , ":type"     := duDataType
           , ":remarks"  := duRemarks

It's much more convenient to write with named arguments (as any other query) because we don't need to care about order in which arguments are passed.

It would be really great, if something like this can be supported in mysql-simple library as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment