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

Function TrimSuffixAndGetInstanceDatabaseID

backend/common/resource_name.go:122–128  ·  view source on GitHub ↗

TrimSuffixAndGetInstanceDatabaseID trims the suffix from the name and returns the instance ID and database ID.

(name string, suffix string)

Source from the content-addressed store, hash-verified

120
121// TrimSuffixAndGetInstanceDatabaseID trims the suffix from the name and returns the instance ID and database ID.
122func TrimSuffixAndGetInstanceDatabaseID(name string, suffix string) (string, string, error) {
123 trimmed, err := TrimSuffix(name, suffix)
124 if err != nil {
125 return "", "", err
126 }
127 return GetInstanceDatabaseID(trimmed)
128}
129
130// GetEnvironmentID returns the environment ID from a resource name.
131func GetEnvironmentID(name string) (string, error) {

Callers 3

GetDatabaseSchemaMethod · 0.92
GetDatabaseSDLSchemaMethod · 0.92
GetSchemaStringMethod · 0.92

Calls 2

TrimSuffixFunction · 0.85
GetInstanceDatabaseIDFunction · 0.70

Tested by

no test coverage detected