MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / SafeDocumentName

Function SafeDocumentName

db/util_testing.go:1016–1023  ·  view source on GitHub ↗

SafeDocumentName returns a document name free of any special characters for use in tests.

(t *testing.T, name string)

Source from the content-addressed store, hash-verified

1014
1015// SafeDocumentName returns a document name free of any special characters for use in tests.
1016func SafeDocumentName(t *testing.T, name string) string {
1017 docName := strings.ToLower(name)
1018 for _, c := range []string{" ", "<", ">", "/", "="} {
1019 docName = strings.ReplaceAll(docName, c, "_")
1020 }
1021 require.Less(t, len(docName), 251, "Document name %s is too long, must be less than 251 characters", name)
1022 return docName
1023}

Calls 1

LessMethod · 0.45