MCPcopy Create free account
hub / github.com/bytebase/bytebase / TrimSuffix

Function TrimSuffix

backend/common/resource_name.go:510–515  ·  view source on GitHub ↗

TrimSuffix trims the suffix from the name and returns the trimmed name.

(name, suffix string)

Source from the content-addressed store, hash-verified

508
509// TrimSuffix trims the suffix from the name and returns the trimmed name.
510func TrimSuffix(name, suffix string) (string, error) {
511 if !strings.HasSuffix(name, suffix) {
512 return "", errors.Errorf("invalid request %q with suffix %q", name, suffix)
513 }
514 return strings.TrimSuffix(name, suffix), nil
515}
516
517// GetNameParentTokens returns the tokens from a resource name.
518func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error) {

Callers 4

GetDatabaseCatalogMethod · 0.92
UpdateDatabaseCatalogMethod · 0.92
GetDatabaseMetadataMethod · 0.92

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected