Updated CopyFromSlice example in doc.go
The example had a syntax error and didn't explain what user was to begin with. Fixed it.
This commit is contained in:
committed by
Jack Christensen
parent
fc4d50f6c2
commit
b664891853
@@ -289,7 +289,7 @@ When you already have a typed array using CopyFromSlice can be more convenient.
|
|||||||
pgx.Identifier{"people"},
|
pgx.Identifier{"people"},
|
||||||
[]string{"first_name", "last_name", "age"},
|
[]string{"first_name", "last_name", "age"},
|
||||||
pgx.CopyFromSlice(len(rows), func(i int) ([]interface{}, error) {
|
pgx.CopyFromSlice(len(rows), func(i int) ([]interface{}, error) {
|
||||||
return []interface{user.FirstName, user.LastName, user.Age}, nil
|
return []interface{}{rows[i].FirstName, rows[i].LastName, rows[i].Age}, nil
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user