Fix a bug that could occur on no-field inserts

This commit is contained in:
Aaron L 2017-04-04 19:42:49 -07:00
parent d13410617f
commit 10cfe74989

View file

@ -86,10 +86,13 @@ func (o *{{$tableNameSingular}}) Insert(exec boil.Executor, whitelist ... string
{{else -}} {{else -}}
queryOutput = fmt.Sprintf("OUTPUT INSERTED.{{.LQ}}%s{{.RQ}} ", strings.Join(returnColumns, "{{.RQ}},INSERTED.{{.LQ}}")) queryOutput = fmt.Sprintf("OUTPUT INSERTED.{{.LQ}}%s{{.RQ}} ", strings.Join(returnColumns, "{{.RQ}},INSERTED.{{.LQ}}"))
{{end -}} {{end -}}
{{- end}} {{end -}}
} }
if len(wl) != 0 {
cache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning) cache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)
} }
}
value := reflect.Indirect(reflect.ValueOf(o)) value := reflect.Indirect(reflect.ValueOf(o))
vals := queries.ValuesFromMapping(value, cache.valueMapping) vals := queries.ValuesFromMapping(value, cache.valueMapping)