Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiee committed Feb 3, 2023
1 parent 5dc295c commit 15c5d37
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 118 deletions.
5 changes: 2 additions & 3 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ package nebula_go
import (
"crypto/tls"
"fmt"
"math"
"net"
"strconv"
"time"
Expand Down Expand Up @@ -46,8 +45,8 @@ func (cn *connection) open(hostAddress HostAddress, timeout time.Duration, sslCo
port := hostAddress.Port
newAdd := net.JoinHostPort(ip, strconv.Itoa(port))
cn.timeout = timeout
bufferSize := 128 << 10
frameMaxLength := uint32(math.MaxUint32)
// bufferSize := 128 << 10
// frameMaxLength := uint32(math.MaxUint32)

var err error
var sock thrift.Transport
Expand Down
112 changes: 57 additions & 55 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,62 +103,64 @@ func (session *Session) Execute(stmt string) (*ResultSet, error) {

// ExecuteJson returns the result of the given query as a json string
// Date and Datetime will be returned in UTC
//
// JSON struct:
// {
// "results":[
// {
// "columns":[
// ],
// "data":[
// {
// "row":[
// "row-data"
// ],
// "meta":[
// "metadata"
// ]
// }
// ],
// "latencyInUs":0,
// "spaceName":"",
// "planDesc ":{
// "planNodeDescs":[
// {
// "name":"",
// "id":0,
// "outputVar":"",
// "description":{
// "key":""
// },
// "profiles":[
// {
// "rows":1,
// "execDurationInUs":0,
// "totalDurationInUs":0,
// "otherStats":{}
// }
// ],
// "branchInfo":{
// "isDoBranch":false,
// "conditionNodeId":-1
// },
// "dependencies":[]
// }
// ],
// "nodeIndexMap":{},
// "format":"",
// "optimize_time_in_us":0
// },
// "comment ":""
// }
// ],
// "errors":[
// {
// "code": 0,
// "message": ""
// }
// ]
// }
//
// {
// "results":[
// {
// "columns":[
// ],
// "data":[
// {
// "row":[
// "row-data"
// ],
// "meta":[
// "metadata"
// ]
// }
// ],
// "latencyInUs":0,
// "spaceName":"",
// "planDesc ":{
// "planNodeDescs":[
// {
// "name":"",
// "id":0,
// "outputVar":"",
// "description":{
// "key":""
// },
// "profiles":[
// {
// "rows":1,
// "execDurationInUs":0,
// "totalDurationInUs":0,
// "otherStats":{}
// }
// ],
// "branchInfo":{
// "isDoBranch":false,
// "conditionNodeId":-1
// },
// "dependencies":[]
// }
// ],
// "nodeIndexMap":{},
// "format":"",
// "optimize_time_in_us":0
// },
// "comment ":""
// }
// ],
// "errors":[
// {
// "code": 0,
// "message": ""
// }
// ]
// }
func (session *Session) ExecuteJson(stmt string) ([]byte, error) {
return session.ExecuteJsonWithParameter(stmt, map[string]interface{}{})
}
Expand Down
114 changes: 58 additions & 56 deletions session_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,70 +146,72 @@ func (pool *SessionPool) ExecuteWithParameter(stmt string, params map[string]int

// ExecuteJson returns the result of the given query as a json string
// Date and Datetime will be returned in UTC
//
// JSON struct:
// {
// "results":[
// {
// "columns":[
// ],
// "data":[
// {
// "row":[
// "row-data"
// ],
// "meta":[
// "metadata"
// ]
// }
// ],
// "latencyInUs":0,
// "spaceName":"",
// "planDesc ":{
// "planNodeDescs":[
// {
// "name":"",
// "id":0,
// "outputVar":"",
// "description":{
// "key":""
// },
// "profiles":[
// {
// "rows":1,
// "execDurationInUs":0,
// "totalDurationInUs":0,
// "otherStats":{}
// }
// ],
// "branchInfo":{
// "isDoBranch":false,
// "conditionNodeId":-1
// },
// "dependencies":[]
// }
// ],
// "nodeIndexMap":{},
// "format":"",
// "optimize_time_in_us":0
// },
// "comment ":""
// }
// ],
// "errors":[
// {
// "code": 0,
// "message": ""
// }
// ]
// }
//
// {
// "results":[
// {
// "columns":[
// ],
// "data":[
// {
// "row":[
// "row-data"
// ],
// "meta":[
// "metadata"
// ]
// }
// ],
// "latencyInUs":0,
// "spaceName":"",
// "planDesc ":{
// "planNodeDescs":[
// {
// "name":"",
// "id":0,
// "outputVar":"",
// "description":{
// "key":""
// },
// "profiles":[
// {
// "rows":1,
// "execDurationInUs":0,
// "totalDurationInUs":0,
// "otherStats":{}
// }
// ],
// "branchInfo":{
// "isDoBranch":false,
// "conditionNodeId":-1
// },
// "dependencies":[]
// }
// ],
// "nodeIndexMap":{},
// "format":"",
// "optimize_time_in_us":0
// },
// "comment ":""
// }
// ],
// "errors":[
// {
// "code": 0,
// "message": ""
// }
// ]
// }
func (pool *SessionPool) ExecuteJson(stmt string) ([]byte, error) {
return pool.ExecuteJsonWithParameter(stmt, map[string]interface{}{})
}

// ExecuteJson returns the result of the given query as a json string
// Date and Datetime will be returned in UTC
// The result is a JSON string in the same format as ExecuteJson()
//TODO(Aiee) check the space name
// TODO(Aiee) check the space name
func (pool *SessionPool) ExecuteJsonWithParameter(stmt string, params map[string]interface{}) ([]byte, error) {
return nil, fmt.Errorf("not implemented")

Expand Down
8 changes: 4 additions & 4 deletions value_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ func (valWrap ValueWrapper) GetType() string {
//
// Maps in the output will be sorted by key value in alphabetical order.
//
// For vetex, the output is in form (vid: tagName{propKey: propVal, propKey2, propVal2}),
// For edge, the output is in form (SrcVid)-[name]->(DstVid)@Ranking{prop1: val1, prop2: val2}
// where arrow direction depends on edgeType.
// For path, the output is in form (v1)-[name@edgeRanking]->(v2)-[name@edgeRanking]->(v3)
// For vetex, the output is in form (vid: tagName{propKey: propVal, propKey2, propVal2}),
// For edge, the output is in form (SrcVid)-[name]->(DstVid)@Ranking{prop1: val1, prop2: val2}
// where arrow direction depends on edgeType.
// For path, the output is in form (v1)-[name@edgeRanking]->(v2)-[name@edgeRanking]->(v3)
//
// For time, and dateTime, String returns the value calculated using the timezone offset
// from graph service by default.
Expand Down

0 comments on commit 15c5d37

Please sign in to comment.