entc: blob storage support

This commit is contained in:
Giau. Tran Minh
2026-05-18 17:07:16 +00:00
parent 477cecd0dc
commit 2d33420c0c
37 changed files with 1711 additions and 42 deletions

View File

@@ -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 {