-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:support cypher parameter #72
Conversation
service/dao/dao.go
Outdated
@@ -287,26 +287,29 @@ func Disconnect(nsid string) { | |||
pool.Disconnect(nsid) | |||
} | |||
|
|||
func Execute(nsid string, gql string) (result ExecuteResult, err error) { | |||
func Execute(nsid string, gql string, paramList common.ParameterList) (result ExecuteResult, cmdResult string, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmdResult? what's it like?
service/pool/pool.go
Outdated
if len(request.ParamList) > 0 { | ||
err = executeCmd(request.ParamList, &connection.parameterMap) | ||
if err != nil { | ||
cmdResult = err.Error() | ||
} else { | ||
cmdResult = SetParamsSuccess | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's like that the cmdResult
is not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's error, just return error. The channel response result just return nil, error
enough
refactor: remove vscode file update: fix typo value mod: update local cmd mod: update params mod: support params mod: add type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
service/dao/dao.go
Outdated
@@ -287,26 +287,30 @@ func Disconnect(nsid string) { | |||
pool.Disconnect(nsid) | |||
} | |||
|
|||
func Execute(nsid string, gql string) (result ExecuteResult, err error) { | |||
func Execute(nsid string, gql string, paramList common.ParameterList) (result ExecuteResult, params common.ParameterMap, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put params
into ExecuteResult
?
controllers/db.go
Outdated
if len(paramsMap) == 0 { | ||
res.Params = nil | ||
} else { | ||
res.Params = paramsMap | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value of res.Params
is nil
, need not to assign with nil
.
if len(paramsMap) > 0 {
res.Params = paramsMap
}
service/pool/pool.go
Outdated
@@ -12,11 +15,20 @@ import ( | |||
|
|||
uuid "github.com/satori/go.uuid" | |||
nebula "github.com/vesoft-inc/nebula-go/v2" | |||
nebulaType "github.com/vesoft-inc/nebula-go/v2/nebula" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pkg name alias seems that they are all lowercase, and I haven't seen any uppercase ones.
Use nebulatype
instead?
service/pool/pool.go
Outdated
if reg == nil { | ||
err = errors.New("invalid regular expression") | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reg
cannot be nil
.
*/ | ||
if len(res) != 2 { | ||
return | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless else
.
service/pool/pool.go
Outdated
{ | ||
localCmd = Param | ||
args = []string{plain} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless {
and }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.