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

Function ValidateDatabaseName

db/database.go:306–313  ·  view source on GitHub ↗
(dbName string)

Source from the content-addressed store, hash-verified

304}
305
306func ValidateDatabaseName(dbName string) error {
307 // http://wiki.apache.org/couchdb/HTTP_database_API#Naming_and_Addressing
308 if match, _ := regexp.MatchString(`^[a-z][-a-z0-9_$()+/]*$`, dbName); !match {
309 return base.HTTPErrorf(http.StatusBadRequest,
310 "Illegal database name: %s", dbName)
311 }
312 return nil
313}
314
315// connectToBucketErrorHandling takes the given spec and error and returns a formatted error, along with whether it was a fatal error.
316func connectToBucketErrorHandling(ctx context.Context, spec base.BucketSpec, gotErr error) (fatalError bool, err error) {

Callers 4

GetActiveDatabaseMethod · 0.92
validateVersionMethod · 0.92
NewDatabaseContextFunction · 0.85

Calls 1

HTTPErrorfFunction · 0.92

Tested by

no test coverage detected