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

Function parseVersion

backend/plugin/db/tidb/tidb.go:172–178  ·  view source on GitHub ↗
(version string)

Source from the content-addressed store, hash-verified

170}
171
172func parseVersion(version string) (string, error) {
173 // Examples: 8.0.11-TiDB-v8.5.0, 8.0.11-TiDB-v7.5.2-serverless.
174 if loc := regexp.MustCompile(`v\d+\.\d+\.\d+`).FindStringIndex(version); loc != nil {
175 return version[loc[0]:loc[1]], nil
176 }
177 return "", errors.Errorf("failed to parse version %q", version)
178}
179
180func buildExecuteCommands(statement string) ([]base.Statement, error) {
181 if len(statement) > common.MaxSheetCheckSize {

Callers 2

TestParseVersionFunction · 0.70
getVersionMethod · 0.70

Calls 1

ErrorfMethod · 0.80

Tested by 1

TestParseVersionFunction · 0.56