Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

simply SQL Parser for Go ( powered by vitess and TiDB )

License

NotificationsYou must be signed in to change notification settings

blastrain/vitess-sqlparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simply SQL and DDL parser for Go (powered by vitess and TiDB )this library inspired byhttps://github.com/xwb1989/sqlparser

(original source :https://github.com/youtube/vitess/tree/master/go/vt/sqlparser)

Why

xwb1989/sqlparser is famous sql parser in Go.
But it cannot parse some query (like offset or bulk insert...) because it customizes vitess's sql parser.

Also, some libraries use from vitess sql parser directly. But vitess's sql parser only partial supports DDL parsing.

We want to perfectly support parsing for SQL and DDL.
Therefore we use vitess sql parser directly and also use TiDB parser for DDL parsing.

Compare SQL parser libraries in Go

librarysupports offset (or other complexity) querysupports DDL
xwb1989/sqlparser
zhenjl/sqlparser
knocknote/vitess-sqlparser

Installation

[NOTE] Required Go version more than 1.9

go get -u github.com/knocknote/vitess-sqlparser

Examples

package mainimport ("fmt""github.com/blastrain/vitess-sqlparser/sqlparser")funcmain() {stmt,err:=sqlparser.Parse("select * from user_items where user_id=1 order by created_at limit 3 offset 10")iferr!=nil {panic(err)}fmt.Printf("stmt = %+v\n",stmt)}

About

simply SQL Parser for Go ( powered by vitess and TiDB )

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp