mirror of
https://github.com/VinGarcia/ksql.git
synced 2025-09-03 03:27:48 +00:00
Updated PGX Support (markdown)
parent
afcdf45cad
commit
ba77fdefe2
@ -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)
|
||||
}
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user