summaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgx/v5/rows.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/jackc/pgx/v5/rows.go')
-rw-r--r--vendor/github.com/jackc/pgx/v5/rows.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/vendor/github.com/jackc/pgx/v5/rows.go b/vendor/github.com/jackc/pgx/v5/rows.go
index 73efffa0a..1ad917655 100644
--- a/vendor/github.com/jackc/pgx/v5/rows.go
+++ b/vendor/github.com/jackc/pgx/v5/rows.go
@@ -667,7 +667,12 @@ const structTagKey = "db"
func fieldPosByName(fldDescs []pgconn.FieldDescription, field string) (i int) {
i = -1
for i, desc := range fldDescs {
- if strings.EqualFold(desc.Name, field) {
+
+ // Snake case support.
+ field = strings.ReplaceAll(field, "_", "")
+ descName := strings.ReplaceAll(desc.Name, "_", "")
+
+ if strings.EqualFold(descName, field) {
return i
}
}