Commit 7728d2d
committed
docs: explain scanning array_agg (and other PG arrays) into Go slices
Users hitting a query that uses `array_agg` (or any PG array-returning
expression) and who try to scan its result into a struct field often see
"unable to assign to *[]int64" and assume the feature is missing. The
two-step recipe from #1900 — scan the array scalar into a slice with
`QueryRow` / slice-typed `Scan`, and compose slice fields into structs
via `CollectRows` / `RowToStructByName` — is the canonical answer but
isn't currently discoverable from the package docs.
Add a short paragraph with both forms to the PostgreSQL Data Types
section of `doc.go` so `go doc pgx` / pkg.go.dev surface the recipe.
Closes #1900
Signed-off-by: Ali <alliasgher123@gmail.com>1 parent 0aeabbc commit 7728d2d
1 file changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
77 | 98 | | |
78 | 99 | | |
79 | 100 | | |
| |||
0 commit comments