From 4c36f2aa6469c0bfbbfaf7718459ed97f7a62dac Mon Sep 17 00:00:00 2001 From: Florent Poinsard <35779988+frouioui@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:41:06 -0600 Subject: [PATCH] Export `convertMySQLVersionToCommentVersion` to use it in vitess-operator (#14988) Signed-off-by: Florent Poinsard --- go/vt/sqlparser/parser.go | 8 ++++---- go/vt/sqlparser/version_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go/vt/sqlparser/parser.go b/go/vt/sqlparser/parser.go index 68eff1c54e4..d4948396ae5 100644 --- a/go/vt/sqlparser/parser.go +++ b/go/vt/sqlparser/parser.go @@ -100,8 +100,8 @@ func (p *Parser) Parse2(sql string) (Statement, BindVars, error) { return tokenizer.ParseTree, tokenizer.BindVars, nil } -// convertMySQLVersionToCommentVersion converts the MySQL version into comment version format. -func convertMySQLVersionToCommentVersion(version string) (string, error) { +// ConvertMySQLVersionToCommentVersion converts the MySQL version into comment version format. +func ConvertMySQLVersionToCommentVersion(version string) (string, error) { var res = make([]int, 3) idx := 0 val := "" @@ -323,7 +323,7 @@ func New(opts Options) (*Parser, error) { if opts.MySQLServerVersion == "" { opts.MySQLServerVersion = config.DefaultMySQLVersion } - convVersion, err := convertMySQLVersionToCommentVersion(opts.MySQLServerVersion) + convVersion, err := ConvertMySQLVersionToCommentVersion(opts.MySQLServerVersion) if err != nil { return nil, err } @@ -335,7 +335,7 @@ func New(opts Options) (*Parser, error) { } func NewTestParser() *Parser { - convVersion, err := convertMySQLVersionToCommentVersion(config.DefaultMySQLVersion) + convVersion, err := ConvertMySQLVersionToCommentVersion(config.DefaultMySQLVersion) if err != nil { panic(err) } diff --git a/go/vt/sqlparser/version_test.go b/go/vt/sqlparser/version_test.go index 718b5804aad..8b570404cee 100644 --- a/go/vt/sqlparser/version_test.go +++ b/go/vt/sqlparser/version_test.go @@ -49,7 +49,7 @@ func TestConvertMySQLVersion(t *testing.T) { for _, tcase := range testcases { t.Run(tcase.version, func(t *testing.T) { - output, err := convertMySQLVersionToCommentVersion(tcase.version) + output, err := ConvertMySQLVersionToCommentVersion(tcase.version) if tcase.error != "" { require.EqualError(t, err, tcase.error) } else {