-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print execution plan information in console (#4)
* some utils * Refactor * upgrade nebula go * Use table library to print * Print plan description * Use go pretty v6 * Print graphviz dot string * Print loop and select branch * Set style of table writer * Upgrade nebula-go and fix table writer config * Refactor plan desc printer * print dot graphviz * Fix comments * Refactor and cleanup * Print execution plan title
- Loading branch information
Showing
14 changed files
with
505 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
insert_final_newline = true | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{Makefile,go.mod,go.sum,*.go}] | ||
indent_style = tab | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,6 @@ | |
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
vendor/ | ||
|
||
nebula-console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
.PHONY: build vendorbuild clean fmt | ||
|
||
default: build | ||
|
||
build: clean fmt | ||
go build -o nebula-console | ||
|
||
vendorbuild: clean fmt | ||
@go mod vendor && go build -mod vendor -o nebula-console | ||
|
||
clean: | ||
@rm -rf nebula-console vendor | ||
|
||
fmt: | ||
@find . -path vendor -prune -type f -iname '*.go' -exec go fmt {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* Copyright (c) 2020 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
package completer | ||
|
||
import "github.com/vesoft-inc/readline" | ||
|
||
var prefixCompleter = readline.NewPrefixCompleter( | ||
// show | ||
readline.PcItem("SHOW", | ||
readline.PcItem("HOSTS"), | ||
readline.PcItem("SPACES"), | ||
readline.PcItem("PARTS"), | ||
readline.PcItem("TAGS"), | ||
readline.PcItem("EDGES"), | ||
readline.PcItem("USERS"), | ||
readline.PcItem("ROLES"), | ||
readline.PcItem("USER"), | ||
readline.PcItem("CONFIGS"), | ||
), | ||
|
||
// describe | ||
readline.PcItem("DESCRIBE", | ||
readline.PcItem("TAG"), | ||
readline.PcItem("EDGE"), | ||
readline.PcItem("SPACE"), | ||
), | ||
readline.PcItem("DESC", | ||
readline.PcItem("TAG"), | ||
readline.PcItem("EDGE"), | ||
readline.PcItem("SPACE"), | ||
), | ||
// get configs | ||
readline.PcItem("GET", | ||
readline.PcItem("CONFIGS"), | ||
), | ||
// create | ||
readline.PcItem("CREATE", | ||
readline.PcItem("SPACE"), | ||
readline.PcItem("TAG"), | ||
readline.PcItem("EDGE"), | ||
readline.PcItem("USER"), | ||
), | ||
// drop | ||
readline.PcItem("DROP", | ||
readline.PcItem("SPACE"), | ||
readline.PcItem("TAG"), | ||
readline.PcItem("EDGE"), | ||
readline.PcItem("USER"), | ||
), | ||
// alter | ||
readline.PcItem("ALTER", | ||
readline.PcItem("USER"), | ||
readline.PcItem("TAG"), | ||
readline.PcItem("EDGE"), | ||
), | ||
|
||
// insert | ||
readline.PcItem("INSERT", | ||
readline.PcItem("VERTEX"), | ||
readline.PcItem("EDGE"), | ||
), | ||
// update | ||
readline.PcItem("UPDATE", | ||
readline.PcItem("CONFIGS"), | ||
readline.PcItem("VERTEX"), | ||
readline.PcItem("EDGE"), | ||
), | ||
// upsert | ||
readline.PcItem("UPSERT", | ||
readline.PcItem("VERTEX"), | ||
readline.PcItem("EDGE"), | ||
), | ||
// delete | ||
readline.PcItem("DELETE", | ||
readline.PcItem("VERTEX"), | ||
readline.PcItem("EDGE"), | ||
), | ||
|
||
// grant | ||
readline.PcItem("GRANT", | ||
readline.PcItem("ROLE"), | ||
), | ||
// revoke | ||
readline.PcItem("REVOKE", | ||
readline.PcItem("ROLE"), | ||
), | ||
// change password | ||
readline.PcItem("CHANGE", | ||
readline.PcItem("PASSWORD"), | ||
), | ||
) | ||
|
||
func NewCompleter() *readline.PrefixCompleter { | ||
return prefixCompleter | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
module vesoft-inc/nebula-console | ||
module github.com/vesoft-inc/nebula-console | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/vesoft-inc/nebula-go/v2 v2.0.0-20200722013035-73eebb836e7e | ||
github.com/chzyer/logex v1.1.10 // indirect | ||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect | ||
github.com/jedib0t/go-pretty/v6 v6.0.4 | ||
github.com/stretchr/testify v1.3.0 // indirect | ||
github.com/vesoft-inc/nebula-go/v2 v2.0.0-20200730062750-d87c9abe1422 | ||
github.com/vesoft-inc/readline v0.0.0-20200707112557-889240450af4 | ||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= | ||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= | ||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= | ||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/facebook/fbthrift v0.0.0-20190922225929-2f9839604e25 h1:dezRDs9oGYxeavyvcNg/Js+dK6kIvfzERoJ7K8Xkv14= | ||
github.com/facebook/fbthrift v0.0.0-20190922225929-2f9839604e25/go.mod h1:2tncLx5rmw69e5kMBv/yJneERbzrr1yr5fdlnTbu8lU= | ||
github.com/vesoft-inc/nebula-go/v2 v2.0.0-20200722013035-73eebb836e7e h1:CV/gYc4QM4fyfpxfShsxQ8GgG2vu6u1fP9mhtIB17Sw= | ||
github.com/vesoft-inc/nebula-go/v2 v2.0.0-20200722013035-73eebb836e7e/go.mod h1:92I8vrIc2Rk7/oJO+1hTgjNhHiYfnsW2uu3Ofh0ECnI= | ||
github.com/jedib0t/go-pretty/v6 v6.0.4 h1:7WaHUeKo5yc2vABlsh30p4VWxQoXaWktBY/nR/2qnPg= | ||
github.com/jedib0t/go-pretty/v6 v6.0.4/go.mod h1:MTr6FgcfNdnN5wPVBzJ6mhJeDyiF0yBvS2TMXEV/XSU= | ||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= | ||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= | ||
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= | ||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||
github.com/vesoft-inc/nebula-go/v2 v2.0.0-20200730062750-d87c9abe1422 h1:cPIBBtmtXq9BvK4xh/lq9Yr3yg5ksqFScbREOFYRKxA= | ||
github.com/vesoft-inc/nebula-go/v2 v2.0.0-20200730062750-d87c9abe1422/go.mod h1:92I8vrIc2Rk7/oJO+1hTgjNhHiYfnsW2uu3Ofh0ECnI= | ||
github.com/vesoft-inc/readline v0.0.0-20200707112557-889240450af4 h1:DiyiidZ9FBSwOZfslQeIPeCUo7AjJ59bj3UaTQEY7po= | ||
github.com/vesoft-inc/readline v0.0.0-20200707112557-889240450af4/go.mod h1:E6VDTX2OSL0so+MQj23uMHpp24E2gqbl5nVOSviDIkU= | ||
golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo= | ||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
Oops, something went wrong.