mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc: blob storage support
This commit is contained in:
@@ -49,10 +49,13 @@ in the LICENSE file in the root directory of this source tree.
|
||||
{{ $.ID.Constant }},
|
||||
{{- end }}
|
||||
{{- range $f := $.Fields }}
|
||||
{{- if not $f.IsDeprecated }}
|
||||
{{- if and (not $f.IsDeprecated) (not $f.IsBlobNoColumn) (not $f.IsBlobLazy) }}
|
||||
{{ $f.Constant }},
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $k := $.BlobKeys }}
|
||||
"{{ $k.Field.Name }}",
|
||||
{{- end }}
|
||||
}
|
||||
{{/* If any of the edges owns a foreign-key */}}
|
||||
{{ with $.UnexportedForeignKeys }}
|
||||
@@ -65,6 +68,15 @@ in the LICENSE file in the root directory of this source tree.
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ with $.BlobKeys }}
|
||||
// BlobKeys holds the SQL columns for blob storage keys.
|
||||
var BlobKeys = []string{
|
||||
{{- range $bk := . }}
|
||||
"{{ $bk.Field.Name }}",
|
||||
{{- end }}
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ with $.NumM2M }}
|
||||
var (
|
||||
{{- range $e := $.Edges }}
|
||||
@@ -94,6 +106,13 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
}
|
||||
{{- end }}
|
||||
{{- with $.BlobKeys }}
|
||||
for i := range BlobKeys {
|
||||
if column == BlobKeys[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
{{- end }}
|
||||
{{- with $.DeprecatedFields }}
|
||||
for _, f := range [...]string{ {{- range . }}{{ .Constant }},{{ end }} } {
|
||||
if column == f {
|
||||
|
||||
Reference in New Issue
Block a user