diff --git a/entc/gen/func.go b/entc/gen/func.go index de27f1ac4..5401e66bb 100644 --- a/entc/gen/func.go +++ b/entc/gen/func.go @@ -32,7 +32,6 @@ var ( "appends": reflect.AppendSlice, "order": order, "camel": camel, - "dumpFields": dumpFields, "snake": snake, "pascal": pascal, "extend": extend, @@ -406,29 +405,6 @@ func toString(v interface{}) string { } } -// dumpFields dumps the struct fields into a Go format. -func dumpFields(v interface{}) string { - rv := indirect(reflect.ValueOf(v)) - rt := rv.Type() - fields := make([]string, 0, rv.NumField()) - for i := 0; i < rv.NumField(); i++ { - f := rt.Field(i) - if f.PkgPath != "" { - continue - } - fv := rv.Field(i) - if !fv.IsZero() { - if fv.Kind() == reflect.Ptr { - fv = reflect.Indirect(fv) - fields = append(fields, fmt.Sprintf("%s: &[]%s{%#v}[0]", f.Name, fv.Type(), fv.Interface())) - } else { - fields = append(fields, fmt.Sprintf("%s: %#v", f.Name, fv.Interface())) - } - } - } - return strings.Join(fields, ", ") -} - // dict creates a dictionary from a list of pairs. func dict(v ...interface{}) map[string]interface{} { lenv := len(v)