cockroachdb-parser
is a snapshot of the parser package and
all its dependencies from the CockroachDB repo. The
smaller package is Apache licensed and contains less dependencies
to pull in when configuring compared to go get github.com/cockroachdb/cockroach
.
A README of usage of the parser library can be found here.
The SHA this is based off is available in version
.
Versioning is done by CockroachDB version, with a v0.
prepended.
For example, v0.22.1.0.x.y
maps to v22.1.0
in CockroachDB, where
.x.y
maps to any subiterations.
There are custom patches in patches/
which gets applied to the repo.
This helps us customise the parser slightly for third party users.
import (
...
"github.com/cockroachdb/cockroachdb-parser/pkg/sql/parser"
...
)
func Parse() error {
ast, err := parser.ParseOne("SELECT 1")
if err != nil {
return err
}
// Do something with the AST
_ = ast
}
Ensure the CockroachDB repo is cloned in your $GOPATH, and then type:
./snapshot.sh