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: Target platform display #115

Merged
merged 10 commits into from
Jan 22, 2025
Prev Previous commit
Next Next commit
move common logic for target platform
  • Loading branch information
ayu-devtron committed Jan 22, 2025
commit 0379ab9f35be7bdb4725c41d6f6d573f90fc7ccc
19 changes: 19 additions & 0 deletions common-lib/utils/CommonUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,22 @@ var PgQueryDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "pg_query_duration_seconds",
Help: "Duration of PG queries",
}, []string{"status", "serviceName"})

func GetTargetPlatformObjectFromString(targetPlatformString string) []*bean.TargetPlatform {
targetPlatforms := GetTargetPlatformListFromString(targetPlatformString)
targetPlatformObject := []*bean.TargetPlatform{}
for _, targetPlatform := range targetPlatforms {
if len(targetPlatform) > 0 {
targetPlatformObject = append(targetPlatformObject, &bean.TargetPlatform{Name: targetPlatform})
}
}
return targetPlatformObject
}

func GetTargetPlatformListFromString(targetPlatform string) []string {
return strings.Split(targetPlatform, ",")
}

func GetTargetPlatformStringFromList(targetPlatforms []string) string {
return strings.Join(targetPlatforms, ",")
}
4 changes: 4 additions & 0 deletions common-lib/utils/bean/bean.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,7 @@ type PgQueryEvent struct {
Error error
Query string
}

type TargetPlatform struct {
Name string `json:"name"`
}
Loading