modelRT/constants/parameter_table.go

51 lines
1.3 KiB
Go

// Package constants define constant variable
package constants
import "strings"
const ComponentParameterAttributeGroup = "component"
var supportedDynamicParameterAttributeGroups = [...]string{
"base_extend",
"rated",
"setup",
"model",
"stable",
"craft",
"integrity",
"behavior",
}
// IsSupportedParameterAttributeGroup reports whether token6 identifies a
// parameter attribute group supported by the data-object APIs.
func IsSupportedParameterAttributeGroup(group string) bool {
if group == ComponentParameterAttributeGroup {
return true
}
for _, supportedGroup := range supportedDynamicParameterAttributeGroups {
if group == supportedGroup {
return true
}
}
return false
}
// SupportedDynamicParameterAttributeGroups returns the token6 values backed by
// project_manager dynamic tables.
func SupportedDynamicParameterAttributeGroups() []string {
groups := make([]string, len(supportedDynamicParameterAttributeGroups))
copy(groups, supportedDynamicParameterAttributeGroups[:])
return groups
}
// IsSupportedParameterTableName reports whether a dynamic parameter table has
// one of the supported attribute-group suffixes.
func IsSupportedParameterTableName(tableName string) bool {
for _, suffix := range supportedDynamicParameterAttributeGroups {
if strings.HasSuffix(tableName, "_"+suffix) {
return true
}
}
return false
}