Skip to content

Commit a5096c8

Browse files
committedMar 8, 2021
Add an example in README
1 parent 268c6e2 commit a5096c8

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed
 

‎README.md

+30-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,41 @@ The code is derived from CockroachDB v20.1.11 which supports most of the major f
3030

3131
- https://www.postgresql.org/docs/9.5/features.html
3232

33-
33+
# How to use
34+
35+
```go
36+
package main
37+
38+
import (
39+
"log"
40+
41+
"github.com/auxten/postgresql-parser/pkg/walk"
42+
)
43+
44+
func main() {
45+
sql := `select marr
46+
from (select marr_stat_cd AS marr, label AS l
47+
from root_loan_mock_v4
48+
order by root_loan_mock_v4.age desc, l desc
49+
limit 5) as v4
50+
LIMIT 1;`
51+
w := &walk.AstWalker{
52+
Fn: func(ctx interface{}, node interface{}) (stop bool) {
53+
log.Printf("node type %T", node)
54+
return false
55+
},
56+
}
57+
_, _ = w.Walk(sql, nil)
58+
return
59+
}
60+
61+
```
3462

3563
### 🚧🚧🚧 still under construction 🚧🚧🚧
3664

3765
# Progress
3866
- 2020-02-16 `github.com/auxten/postgresql-parser/pkg/sql/parser` Unit tests works now!
67+
- 2020-03-08 Add walker package.
3968

4069
# Todo
4170
- Fix more unit tests

0 commit comments

Comments
 (0)
Please sign in to comment.