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
5 changes: 5 additions & 0 deletions pkg/common/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "github.com/kelseyhightower/envconfig"

type Environment struct {
NebulaStmtPrefix string `envconfig:"STMT_PREFIX" `
NebulaSkipScan bool `envconfig:"SKIP_SCAN" default:"false"`
}

var nebulaEnv *Environment
Expand All @@ -27,3 +28,7 @@ func ProcessStmt(stmt string) string {
}
return stmt
}

func ShouldSkipScan() bool {
return nebulaEnv.NebulaSkipScan
}
8 changes: 8 additions & 0 deletions pkg/common/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ func TestProcessStmt(t *testing.T) {
getEnv()
assert.Equal(t, "nebula stmt", ProcessStmt("stmt"))
}

func TestSkipScan(t *testing.T) {
getEnv()
assert.False(t, ShouldSkipScan())
os.Setenv("NEBULA_SKIP_SCAN", "true")
getEnv()
assert.True(t, ShouldSkipScan())
}
11 changes: 6 additions & 5 deletions pkg/nebulagraph5/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,12 @@ func (gc *GraphClient) Execute(stmt string) (common.IGraphResponse, error) {
}
}
}
//TODO could add a flag to just decode the first row
if rows != 0 {
for resp.HasNext() {
if err := resp.Scan(anyValues...); err != nil {
return nil, err
if !common.ShouldSkipScan() {
if rows != 0 {
for resp.HasNext() {
if err := resp.Scan(anyValues...); err != nil {
return nil, err
}
}
}
}
Expand Down
Loading