Skip to content

Commit

Permalink
Export convertMySQLVersionToCommentVersion to use it in vitess-oper…
Browse files Browse the repository at this point in the history
…ator (#14988)

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
frouioui authored Jan 18, 2024
1 parent 515c8c4 commit 4c36f2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions go/vt/sqlparser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down Expand Up @@ -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
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/sqlparser/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4c36f2a

Please sign in to comment.