snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s
Some checks failed
build / build (push) Failing after 3s
This commit is contained in:
39
dashboard/convert/dashboardtag.go
Normal file
39
dashboard/convert/dashboardtag.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package convert
|
||||
|
||||
import (
|
||||
"github.com/traggo/server/generated/gqlmodel"
|
||||
"github.com/traggo/server/model"
|
||||
)
|
||||
|
||||
func tagFiltersToExternal(tags []model.DashboardTagFilter, include bool) []*gqlmodel.TimeSpanTag {
|
||||
if len(tags) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
result := []*gqlmodel.TimeSpanTag{}
|
||||
for _, tag := range tags {
|
||||
if tag.Include == include {
|
||||
result = append(result, &gqlmodel.TimeSpanTag{
|
||||
Key: tag.Key,
|
||||
Value: tag.StringValue,
|
||||
})
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func TagFiltersToInternal(gqls []*gqlmodel.InputTimeSpanTag, include bool) []model.DashboardTagFilter {
|
||||
result := make([]model.DashboardTagFilter, 0)
|
||||
for _, tag := range gqls {
|
||||
result = append(result, tagFilterToInternal(*tag, include))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func tagFilterToInternal(gqls gqlmodel.InputTimeSpanTag, include bool) model.DashboardTagFilter {
|
||||
return model.DashboardTagFilter{
|
||||
Key: gqls.Key,
|
||||
StringValue: gqls.Value,
|
||||
Include: include,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user