forked from Zaid-Ajaj/Npgsql.FSharp.Analyzer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect queries within lambda expressions wrapped in single case unions
- Loading branch information
Daniel Francesconi
committed
Dec 8, 2020
1 parent
1d6d26b
commit 784bcf6
Showing
5 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/examples/hashing/syntacticAnalysisFromSingleCaseUnion.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module SyntacticAnalysisFromSingleCaseUnion | ||
|
||
open Npgsql.FSharp | ||
|
||
type SqlAction = SqlAction of (string -> Result<int list, exn>) | ||
|
||
let getData = | ||
SqlAction (fun (connectionString: string) -> | ||
connectionString | ||
|> Sql.connect | ||
|> Sql.query "SELECT * FROM users WHERE user_id = @user_id" | ||
|> Sql.parameters [ "@user_id", Sql.int 42 ] | ||
|> Sql.execute (fun read -> read.int "user_id")) |