entc/gen: remove unused template function

This commit is contained in:
Ariel Mashraki
2021-01-18 19:45:14 +02:00
committed by Ariel Mashraki
parent 3439ca207f
commit 25b7a05543

View File

@@ -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)