Skip to content

Commit

Permalink
feat: allow query as an asset type (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsushmith authored Nov 8, 2023
1 parent 859dde6 commit a4ec45c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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

0 comments on commit a4ec45c

Please sign in to comment.