mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: chagne column-check error format
This commit is contained in:
committed by
Ariel Mashraki
parent
f12ef91829
commit
21989f4aa4
@@ -18,12 +18,12 @@ func columnChecker(table string) func(string) error {
|
||||
check, ok := checks[table]
|
||||
if !ok {
|
||||
return func(string) error {
|
||||
return fmt.Errorf("{{ base $.Config.Package }}: unknown table %q", table)
|
||||
return fmt.Errorf("unknown table %q", table)
|
||||
}
|
||||
}
|
||||
return func(column string) error {
|
||||
if !check(column) {
|
||||
return fmt.Errorf("{{ base $.Config.Package }}: unknown column %q for table %q", column, table)
|
||||
return fmt.Errorf("unknown column %q for table %q", column, table)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func columnChecker(table string) func(string) error {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ordering error: %w", err)})
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("{{ base $.Config.Package }}: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.{{ $f }}(s.C(f)))
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func columnChecker(table string) func(string) error {
|
||||
{{- if $withField }}
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("grouping error: %w", err)})
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("{{ base $.Config.Package }}: %w", err)})
|
||||
return ""
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user