mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: fix name clash in entc template when entity name has initials as tx (#2633)
This commit is contained in:
@@ -111,11 +111,11 @@ func ({{ $receiver }} *{{ $.Name }}) Update() *{{ $.UpdateOneName }} {
|
||||
// Unwrap unwraps the {{ $.Name }} entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func ({{ $receiver }} *{{ $.Name }}) Unwrap() *{{ $.Name }} {
|
||||
tx, ok := {{ $receiver }}.config.driver.(*txDriver)
|
||||
_tx, ok := {{ $receiver }}.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("{{ $pkg }}: {{ $.Name }} is not a transactional entity")
|
||||
}
|
||||
{{ $receiver }}.config.driver = tx.drv
|
||||
{{ $receiver }}.config.driver = _tx.drv
|
||||
return {{ $receiver }}
|
||||
}
|
||||
|
||||
@@ -243,4 +243,4 @@ func ({{ $receiver }} {{ $slice }}) config(cfg config) {
|
||||
{{- xtemplate $tmpl $ }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user