Bring back materialized view generation (#321)
This commit is contained in:
committed by
GitHub
parent
368eebb8a7
commit
16bd2372a7
@@ -36,6 +36,33 @@ var (
|
||||
{{end}}
|
||||
)
|
||||
|
||||
// Materialized view models.
|
||||
var (
|
||||
{{with .Views}}
|
||||
{{range .}}
|
||||
{{$model_name := .ViewName | camelize}}
|
||||
{{$model_name}} = table.New(table.Metadata {
|
||||
Name: "{{.ViewName}}",
|
||||
Columns: []string{
|
||||
{{- range .OrderedColumns}}
|
||||
"{{.}}",
|
||||
{{- end}}
|
||||
},
|
||||
PartKey: []string {
|
||||
{{- range .PartitionKey}}
|
||||
"{{.Name}}",
|
||||
{{- end}}
|
||||
},
|
||||
SortKey: []string{
|
||||
{{- range .ClusteringColumns}}
|
||||
"{{.Name}}",
|
||||
{{- end}}
|
||||
},
|
||||
})
|
||||
{{end}}
|
||||
{{end}}
|
||||
)
|
||||
|
||||
{{with .UserTypes}}
|
||||
{{range .}}
|
||||
{{- $type_name := .Name | camelize}}
|
||||
@@ -61,3 +88,16 @@ type {{$model_name}}Struct struct {
|
||||
}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
|
||||
{{with .Views}}
|
||||
{{range .}}
|
||||
{{- $model_name := .ViewName | camelize}}
|
||||
type {{$model_name}}Struct struct {
|
||||
{{- range .Columns}}
|
||||
{{- if not (eq .Type "empty") }}
|
||||
{{.Name | camelize}} {{.Type | mapScyllaToGoType}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
|
||||
Reference in New Issue
Block a user