entc/gen: move multistorage logic to Go code

Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/94

Reviewed By: alexsn

Differential Revision: D17926186

fbshipit-source-id: b59dc418703bc4faca5230a7354edea1423b7d35
This commit is contained in:
Ariel Mashraki
2019-10-15 06:41:29 -07:00
committed by Facebook Github Bot
parent 36a3971f3d
commit 0c46ce4e5e
10 changed files with 49 additions and 47 deletions

View File

@@ -64,7 +64,7 @@ func ({{ $receiver }} *{{ $builder }}) Save(ctx context.Context) (*{{ $.Name }},
}
{{ end -}}
{{ end -}}
{{- if gt (len $.Storage) 1 -}}
{{- if $.MultiStorage -}}
switch {{ $receiver }}.driver.Dialect() {
{{- range $_, $storage := $.Storage }}
case {{ join $storage.Dialects ", " }}: