MCPcopy Create free account
hub / github.com/rilldata/rill / validateQueryAttributes

Function validateQueryAttributes

runtime/parser/parse_metrics_view.go:1289–1296  ·  view source on GitHub ↗

validateQueryAttributes validates query attribute keys

(attrs map[string]string)

Source from the content-addressed store, hash-verified

1287
1288// validateQueryAttributes validates query attribute keys
1289func validateQueryAttributes(attrs map[string]string) error {
1290 for key := range attrs {
1291 if !queryAttributeKeyRegex.MatchString(key) {
1292 return fmt.Errorf("query attribute key %q contains invalid characters (must be alphanumeric with underscores, hyphens, or dots only)", key)
1293 }
1294 }
1295 return nil
1296}
1297
1298var queryAttributeKeyRegex = regexp.MustCompile(`^[a-zA-Z0-9_.-]+$`)

Callers 2

parseMetricsViewMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1