Skip to content
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

Support for named parameters #24

Merged
merged 1 commit into from
Oct 19, 2024
Merged

Conversation

newhoggy
Copy link
Member

@newhoggy newhoggy commented Oct 19, 2024

This will allow code like this to be written:

    let sql =
            Text.unlines
                [ "UPDATE pairs "
                , " SET value = :value"
                , " WHERE key = :key"
                ]

    encodedParams <-
        pure $
            mconcat
                [ ENC.encode (ENC.column (EP.named "value" EP.text)) value
                , ENC.encode (ENC.column (EP.named "key" EP.key)) key
                ]

    void $
        newExecuteStatement sql
            <&> the @"database" ?~ "my_database"
            <&> the @"parameters" ?~ fmap toSqlParameter (ENC.unEncodedParams encodedParams [])
            >>= sendAws

@newhoggy newhoggy changed the title Suport for named parameters Support for named parameters Oct 19, 2024
@newhoggy newhoggy force-pushed the newhoggy/support-for-named-parameters branch from 4fa47f7 to 43d22fe Compare October 19, 2024 15:01
@newhoggy newhoggy merged commit 70f4602 into main Oct 19, 2024
3 checks passed
@newhoggy newhoggy deleted the newhoggy/support-for-named-parameters branch October 19, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant