diff --git a/rows.go b/rows.go index 73efffa0..2bb95d1f 100644 --- a/rows.go +++ b/rows.go @@ -667,6 +667,11 @@ const structTagKey = "db" func fieldPosByName(fldDescs []pgconn.FieldDescription, field string) (i int) { i = -1 for i, desc := range fldDescs { + + // Support snake and spinal case. + desc.Name = strings.ReplaceAll(desc.Name, "_", "") + desc.Name = strings.ReplaceAll(desc.Name, "-", "") + if strings.EqualFold(desc.Name, field) { return i }