mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: simplify the way to get gen.Field operation
External templates should not deal with storage configuration
This commit is contained in:
committed by
Ariel Mashraki
parent
ded20a0e36
commit
d3a0b89864
@@ -54,7 +54,7 @@ in the LICENSE file in the root directory of this source tree.
|
||||
|
||||
{{ with $.NumM2M }}
|
||||
var (
|
||||
{{- range $_, $e := $.Edges }}
|
||||
{{- range $e := $.Edges }}
|
||||
{{- if $e.M2M }}
|
||||
// {{ $e.PKConstant }} and {{ $e.ColumnConstant }}2 are the table columns denoting the
|
||||
// primary key for the {{ $e.Name }} relation (M2M).
|
||||
|
||||
@@ -22,9 +22,9 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
cfg.driver = &txDriver{tx: tx, drv: c.driver}
|
||||
return &Tx{
|
||||
config: cfg,
|
||||
{{ range $_, $n := $.Nodes -}}
|
||||
{{- range $n := $.Nodes }}
|
||||
{{ $n.Name }}: New{{ $n.Name }}Client(cfg),
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
}, nil
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user