Bring back index model generation (#328)
This commit is contained in:
committed by
GitHub
parent
b0b3ded8da
commit
58d72b0e05
24
cmd/schemagen/testdata/models.go
vendored
24
cmd/schemagen/testdata/models.go
vendored
@@ -47,29 +47,14 @@ var (
|
||||
})
|
||||
)
|
||||
|
||||
// Materialized view models.
|
||||
var (
|
||||
ComposersByName = table.New(table.Metadata{
|
||||
Name: "composers_by_name",
|
||||
Columns: []string{
|
||||
"id",
|
||||
"name",
|
||||
},
|
||||
PartKey: []string{
|
||||
"id",
|
||||
},
|
||||
SortKey: []string{
|
||||
"name",
|
||||
},
|
||||
})
|
||||
)
|
||||
|
||||
// User-defined types (UDT) structs.
|
||||
type AlbumUserType struct {
|
||||
gocqlx.UDT
|
||||
Name string
|
||||
Songwriters []string
|
||||
}
|
||||
|
||||
// Table structs.
|
||||
type PlaylistsStruct struct {
|
||||
Album AlbumUserType
|
||||
Artist string
|
||||
@@ -86,8 +71,3 @@ type SongsStruct struct {
|
||||
Tags []string
|
||||
Title string
|
||||
}
|
||||
|
||||
type ComposersByNameStruct struct {
|
||||
Id [16]byte
|
||||
Name string
|
||||
}
|
||||
|
||||
99
cmd/schemagen/testdata/no_ignore_indexes/models.go
vendored
Normal file
99
cmd/schemagen/testdata/no_ignore_indexes/models.go
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
// Code generated by "gocqlx/cmd/schemagen"; DO NOT EDIT.
|
||||
|
||||
package schemagentest
|
||||
|
||||
import (
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/scylladb/gocqlx/v3"
|
||||
"github.com/scylladb/gocqlx/v3/table"
|
||||
)
|
||||
|
||||
// Table models.
|
||||
var (
|
||||
Playlists = table.New(table.Metadata{
|
||||
Name: "playlists",
|
||||
Columns: []string{
|
||||
"album",
|
||||
"artist",
|
||||
"id",
|
||||
"song_id",
|
||||
"title",
|
||||
},
|
||||
PartKey: []string{
|
||||
"id",
|
||||
},
|
||||
SortKey: []string{
|
||||
"title",
|
||||
"album",
|
||||
"artist",
|
||||
},
|
||||
})
|
||||
|
||||
Songs = table.New(table.Metadata{
|
||||
Name: "songs",
|
||||
Columns: []string{
|
||||
"album",
|
||||
"artist",
|
||||
"data",
|
||||
"duration",
|
||||
"id",
|
||||
"tags",
|
||||
"title",
|
||||
},
|
||||
PartKey: []string{
|
||||
"id",
|
||||
},
|
||||
SortKey: []string{},
|
||||
})
|
||||
)
|
||||
|
||||
// Index models.
|
||||
var (
|
||||
SongsTitleIndex = table.New(table.Metadata{
|
||||
Name: "songs_title_index",
|
||||
Columns: []string{
|
||||
"id",
|
||||
"idx_token",
|
||||
"title",
|
||||
},
|
||||
PartKey: []string{
|
||||
"title",
|
||||
},
|
||||
SortKey: []string{
|
||||
"idx_token",
|
||||
"id",
|
||||
},
|
||||
})
|
||||
)
|
||||
|
||||
// User-defined types (UDT) structs.
|
||||
type AlbumUserType struct {
|
||||
gocqlx.UDT
|
||||
Name string
|
||||
Songwriters []string
|
||||
}
|
||||
|
||||
// Table structs.
|
||||
type PlaylistsStruct struct {
|
||||
Album AlbumUserType
|
||||
Artist string
|
||||
Id [16]byte
|
||||
SongId [16]byte
|
||||
Title string
|
||||
}
|
||||
type SongsStruct struct {
|
||||
Album string
|
||||
Artist string
|
||||
Data []byte
|
||||
Duration gocql.Duration
|
||||
Id [16]byte
|
||||
Tags []string
|
||||
Title string
|
||||
}
|
||||
|
||||
// Index structs.
|
||||
type SongsTitleIndexStruct struct {
|
||||
Id [16]byte
|
||||
IdxToken int64
|
||||
Title string
|
||||
}
|
||||
Reference in New Issue
Block a user