Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow query as an asset type #65

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/asset/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const (
TypeFeatureTable Type = "feature_table"
TypeApplication Type = "application"
TypeModel Type = "model"
TypeQuery Type = "query"
)

// AllSupportedTypes holds a list of all supported types struct
Expand All @@ -19,6 +20,7 @@ var AllSupportedTypes = []Type{
TypeFeatureTable,
TypeApplication,
TypeModel,
TypeQuery,
}

// Type specifies a supported type name
Expand All @@ -33,7 +35,7 @@ func (t Type) String() string {
func (t Type) IsValid() bool {
switch t {
case TypeTable, TypeJob, TypeDashboard, TypeTopic,
TypeFeatureTable, TypeApplication, TypeModel:
TypeFeatureTable, TypeApplication, TypeModel, TypeQuery:
return true
}
return false
Expand Down
3 changes: 2 additions & 1 deletion core/asset/type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func TestTypeString(t *testing.T) {
TypeFeatureTable: "feature_table",
TypeApplication: "application",
TypeModel: "model",
TypeQuery: "query",
} {
t.Run((string)(typ), func(t *testing.T) {
assert.Equal(t, expected, typ.String())
Expand All @@ -24,7 +25,7 @@ func TestTypeString(t *testing.T) {

func TestTypeIsValid(t *testing.T) {
for _, typ := range []Type{
"dashboard", "job", "table", "topic", "feature_table", "application", "model",
"dashboard", "job", "table", "topic", "feature_table", "application", "model", "query",
} {
t.Run((string)(typ), func(t *testing.T) {
assert.Truef(t, typ.IsValid(), "%s should be valid", typ)
Expand Down
4 changes: 4 additions & 0 deletions internal/server/v1beta1/type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func TestGetTypes(t *testing.T) {
Name: "model",
Count: 0,
},
{
Name: "query",
Count: 0,
},
},
}

Expand Down