Skip to content

Commit 1f123ff

Browse files
committed
update tests with assert, range func and style
1 parent 54f4c07 commit 1f123ff

3 files changed

Lines changed: 132 additions & 221 deletions

File tree

examples/generics/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ import (
1515
// docker run --name sqlxpg -p 5444:5432 -e POSTGRES_PASSWORD=password -d docker.io/postgres:17.4
1616

1717
const schema = `
18-
CREATE TABLE IF NOT EXISTS person (
18+
DROP TABLE IF EXISTS person;
19+
CREATE TABLE person (
1920
id SERIAL PRIMARY KEY,
2021
first_name text,
2122
last_name text,
2223
email text
2324
);
2425
TRUNCATE TABLE person;
2526
26-
CREATE TABLE IF NOT EXISTS place (
27+
DROP TABLE IF EXISTS place;
28+
CREATE TABLE place (
2729
country text,
2830
city text NULL,
2931
telcode integer

sqlx.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,6 @@ func fieldsByTraversal(v reflect.Value, traversals [][]int, values []interface{}
12461246
// reflectx.FieldByIndexes initializes pointer fields, including pointers to nested structs.
12471247
// Use optDest to delay it until the first non-NULL value is scanned into a field of a nested struct.
12481248
// That way we can support LEFT JOINs with optional nested structs.
1249-
traversal := traversal
12501249
values[i] = optDest(func() interface{} {
12511250
return reflectx.FieldByIndexes(v, traversal).Addr().Interface()
12521251
})

0 commit comments

Comments
 (0)