gosqlparser is a simple SQL parser.
As simple as:
go get github.com/krasun/gosqlparser
CREATE TABLE table1 (c1 INTEGER, c2 STRING)
DROP TABLE table1
SELECT c1, c2 FROM table1 WHERE c3 == c4 AND c5 == c6
INSERT INTO table1 (c1, c2, c3) VALUES (5, "some string", 10)
UPDATE table1 SET c1 = 10 WHERE c1 == 5 AND c3 == "quoted string"
DELETE FROM table1 WHERE c1 == 5 AND c3 == "quoted string"
To make sure that the code is fully tested and covered:
$ go test . ok github.com/krasun/gosqlparser 0.470s
- krasun/gosqldb - my experimental implementation of a simple database.
gosqlparser is released under the MIT license.