schemagen cli

This commit is contained in:
Vladimir Shteinman
2021-11-13 13:55:44 +02:00
committed by Michal Jan Matczuk
parent 979397bc5e
commit 1bfe101568
6 changed files with 471 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
// Code generated by "gocqlx/cmd/schemagen"; DO NOT EDIT.
package {{.PackageName}}
import "github.com/scylladb/gocqlx/v2/table"
{{with .Tables}}
{{range .}}
{{$model_name := .Name | camelize}}
var {{$model_name}}Metadata = table.Metadata {
Name: "{{.Name}}",
Columns: []string{
{{- range .OrderedColumns}}
"{{.}}",
{{- end}}
},
PartKey: []string {
{{- range .PartitionKey}}
"{{.Name}}",
{{- end}}
},
SortKey: []string{
{{- range .ClusteringColumns}}
"{{.Name}}",
{{- end}}
},
}
var {{$model_name}}Table = table.New({{$model_name}}Metadata)
{{end}}
{{end}}