Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ There are elements of the original work that are not required, but may take some
## Rebuilding parser


```
```bash
make -C go/vt/sqlparser
```


After changes to the ast:

```
cd go/vt/sqlparser

go run ./visitorgen/main -input=ast.go -output=rewriter.go
```bash
cicd/build_scripts/01_ast_rebuild.sh
```


Expand Down
9 changes: 9 additions & 0 deletions cicd/build_scripts/01_ast_rebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

CURDIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

REPOSITORY_ROOT="$(realpath "${CURDIR}/../..")"

cd "${REPOSITORY_ROOT}/go/vt/sqlparser"

go run ./visitorgen/main -input=ast.go -output=rewriter.go
51 changes: 27 additions & 24 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,40 +131,43 @@ type (
// of the implications the deletion part may have on vindexes.
// If you add fields here, consider adding them to calls to validateUnshardedRoute.
Insert struct {
Action string
Comments Comments
Ignore string
Table TableName
Partitions Partitions
Columns Columns
Rows InsertRows
OnDup OnDup
Action string
Comments Comments
Ignore string
Table TableName
Partitions Partitions
Columns Columns
Rows InsertRows
OnDup OnDup
SelectExprs SelectExprs
}

// Update represents an UPDATE statement.
// If you add fields here, consider adding them to calls to validateUnshardedRoute.
Update struct {
Action string
Comments Comments
Ignore string
TableExprs TableExprs
Exprs UpdateExprs
From TableExprs
Where *Where
OrderBy OrderBy
Limit *Limit
Action string
Comments Comments
Ignore string
TableExprs TableExprs
Exprs UpdateExprs
From TableExprs
Where *Where
OrderBy OrderBy
Limit *Limit
SelectExprs SelectExprs
}

// Delete represents a DELETE statement.
// If you add fields here, consider adding them to calls to validateUnshardedRoute.
Delete struct {
Comments Comments
Targets TableNames
TableExprs TableExprs
Partitions Partitions
Where *Where
OrderBy OrderBy
Limit *Limit
Comments Comments
Targets TableNames
TableExprs TableExprs
Partitions Partitions
Where *Where
OrderBy OrderBy
Limit *Limit
SelectExprs SelectExprs
}

// Set represents a SET statement.
Expand Down
15 changes: 15 additions & 0 deletions go/vt/sqlparser/rewriter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading