Skip to content

Support for named parameters #28

@chshersh

Description

@chshersh

Currently in order to use arguments with SQL queries I'm using question marks ?. I wonder, how difficult it would to add support for named parameters to be able to write queries like this:

    updateUploadHistory :: UTCTime -> m ()
    updateUploadHistory curTime = executeNamed_ [sql|
        INSERT INTO file_upload_history
            (file_name, uploader_id, timestamp, data_type, remarks)
        VALUES
            (: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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions