diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-04-15 19:10:41 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-04-15 19:10:41 +0200 |
| commit | 0adf505773054a92d77a9c937c8c5e56e74493e0 (patch) | |
| tree | 47f3046852a5927bf7ad3f85e6c60ec97cb15f8d /plan.go | |
| parent | a818aab2a4b48e399d5186c235149ef21011a4af (diff) | |
| download | go-oblast-0adf505773054a92d77a9c937c8c5e56e74493e0.tar.gz | |
increase test coverage for planning
Diffstat (limited to 'plan.go')
| -rw-r--r-- | plan.go | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -56,7 +56,7 @@ type planOpts struct { // buildPlan creates a new plan for the given struct type. func buildPlan(t reflect.Type, dialect Dialect, opts planOpts) (plan, error) { if t.Kind() != reflect.Struct { - return plan{}, fmt.Errorf("expected struct type, but got kind %s", t.Kind().String()) + return plan{}, fmt.Errorf("expected struct type, but got kind %q", t.Kind().String()) } var p = plan{ @@ -134,7 +134,7 @@ func buildPlan(t reflect.Type, dialect Dialect, opts planOpts) (plan, error) { case "auto": p.AutoColumnNames = append(p.AutoColumnNames, columnName) default: - return plan{}, fmt.Errorf("unknown tag `db:%q` on field index %v", ","+tag, field.Index) + return plan{}, fmt.Errorf("unknown option `db:%q` on field %q", ","+tag, field.Name) } } } @@ -146,7 +146,7 @@ func buildPlan(t reflect.Type, dialect Dialect, opts planOpts) (plan, error) { for _, index := range indexesOfUnusedTransparentStructs { field := t.FieldByIndex(index) return plan{}, fmt.Errorf( - "field %q of type %s does not contain any mapped fields (to map this entire field to a DB column, add an explicit `db:\"...\"` tag)", + "field %q of type %s does not contain any mapped fields (to map this whole field to a DB column, add an explicit `db:\"...\"` tag)", field.Name, field.Type.String(), ) } @@ -179,9 +179,8 @@ func buildPlan(t reflect.Type, dialect Dialect, opts planOpts) (plan, error) { p.FillIDWithSetUint = true default: return plan{}, fmt.Errorf( - "column is marked as auto-filled (%s), but this SQL dialect only supports auto-filling struct fields with integer types", - strings.Join(p.AutoColumnNames, ", "), - ) + "column %q is marked as auto-filled, but this SQL dialect only supports auto-filling struct fields with integer types", + columnName) } default: return plan{}, fmt.Errorf( |
