From ba77fdefe2cef9bb9cf3a64eb7da8a554545992b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Sun, 2 Jul 2023 22:18:21 -0300 Subject: [PATCH] Updated PGX Support (markdown) --- PGX-Support.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PGX-Support.md b/PGX-Support.md index 72963df..ddbff17 100644 --- a/PGX-Support.md +++ b/PGX-Support.md @@ -21,11 +21,12 @@ The example query below also [available here][examples/pgxsupport] illustrates o [examples/pgxsupport]: https://github.com/VinGarcia/ksql/blob/master/examples/pgxsupport/main.go#L92 ```golang +func checkIfUserBelongsToTeams(ctx context.Context, db ksql.Provider, userID int, teamIDs []int) { // Check if user belongs to either of the input teams: var row struct { Count pgtype.Int8 `ksql:"c"` } - err = db.QueryOne(ctx, &row, + err := db.QueryOne(ctx, &row, `SELECT count(*) as c FROM users AS u JOIN team_members AS tm @@ -40,4 +41,5 @@ The example query below also [available here][examples/pgxsupport] illustrates o } fmt.Printf("Count: %+v\n", row.Count.Int) +} ``` \ No newline at end of file