MCPcopy Index your code
hub / github.com/bytebase/bytebase / encodeOperatorEmail

Function encodeOperatorEmail

backend/plugin/db/bigquery/bigquery.go:305–321  ·  view source on GitHub ↗

encodeOperatorEmail encodes email to valid format of resource label value. https://cloud.google.com/compute/docs/labeling-resources#requirements

(email string)

Source from the content-addressed store, hash-verified

303// encodeOperatorEmail encodes email to valid format of resource label value.
304// https://cloud.google.com/compute/docs/labeling-resources#requirements
305func encodeOperatorEmail(email string) string {
306 var values []rune
307 for _, c := range email {
308 switch {
309 case unicode.IsDigit(c) || c == '_' || c == '-':
310 values = append(values, c)
311 case unicode.IsLetter(c):
312 values = append(values, unicode.ToLower(c))
313 default:
314 values = append(values, '_')
315 }
316 }
317 if len(values) > 63 {
318 return string(values[:63])
319 }
320 return string(values)
321}
322
323func getStatementWithResultLimit(statement string, limit int) string {
324 limitPart := ""

Callers 3

QueryConnMethod · 0.85
dryRunQueryMethod · 0.85
TestEncodeOperatorEmailFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestEncodeOperatorEmailFunction · 0.68