MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / isMySQLVersionOK

Function isMySQLVersionOK

cmd/sqlc-test-setup/main.go:91–107  ·  view source on GitHub ↗

isMySQLVersionOK checks if the mysqld --version output indicates MySQL 9+. Example version string: "/usr/sbin/mysqld Ver 8.0.44-0ubuntu0.24.04.2 ..."

(versionOutput string)

Source from the content-addressed store, hash-verified

89// isMySQLVersionOK checks if the mysqld --version output indicates MySQL 9+.
90// Example version string: "/usr/sbin/mysqld Ver 8.0.44-0ubuntu0.24.04.2 ..."
91func isMySQLVersionOK(versionOutput string) bool {
92 // Look for "Ver X.Y.Z" pattern
93 fields := strings.Fields(versionOutput)
94 for i, f := range fields {
95 if strings.EqualFold(f, "Ver") && i+1 < len(fields) {
96 ver := strings.Split(fields[i+1], ".")
97 if len(ver) > 0 {
98 major := strings.TrimLeft(ver[0], "0")
99 if major == "" {
100 return false
101 }
102 return major[0] >= '9'
103 }
104 }
105 }
106 return false
107}
108
109// pgBaseDir returns the sqlc-specific directory where PostgreSQL is installed,
110// using the user's cache directory (~/.cache/sqlc/postgresql on Linux).

Callers 1

installMySQLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected