Documentation
¶
Index ¶
- func IsError(resp *graph.ExecutionResponse) bool
- type ConnectionPool
- type DateTimeWrapper
- type DateWrapper
- type DefaultLogger
- type ErrorCode
- type HostAddress
- type Logger
- type Node
- func (node Node) GetID() ValueWrapper
- func (node Node) GetTags() []string
- func (node Node) HasTag(label string) bool
- func (n1 Node) IsEqualTo(n2 *Node) bool
- func (node Node) Keys(tagName string) ([]string, error)
- func (node Node) Properties(tagName string) (map[string]*ValueWrapper, error)
- func (node Node) String() string
- func (node Node) Values(tagName string) ([]*ValueWrapper, error)
- type PathWrapper
- func (path *PathWrapper) ContainsNode(node Node) bool
- func (path *PathWrapper) ContainsRelationship(relationship *Relationship) bool
- func (path *PathWrapper) GetEndNode() (*Node, error)
- func (path *PathWrapper) GetNodes() []*Node
- func (path *PathWrapper) GetPathLength() int
- func (path *PathWrapper) GetRelationships() []*Relationship
- func (path *PathWrapper) GetSegments() []segment
- func (path *PathWrapper) GetStartNode() (*Node, error)
- func (p1 *PathWrapper) IsEqualTo(p2 *PathWrapper) bool
- func (pathWrap *PathWrapper) String() string
- type PoolConfig
- type Record
- type Relationship
- func (relationship Relationship) GetDstVertexID() ValueWrapper
- func (relationship Relationship) GetEdgeName() string
- func (relationship Relationship) GetRanking() int64
- func (relationship Relationship) GetSrcVertexID() ValueWrapper
- func (r1 Relationship) IsEqualTo(r2 *Relationship) bool
- func (relationship Relationship) Keys() []string
- func (relationship Relationship) Properties() map[string]*ValueWrapper
- func (relationship Relationship) String() string
- func (relationship Relationship) Values() []*ValueWrapper
- type ResultSet
- func (res ResultSet) AsStringTable() [][]string
- func (res ResultSet) GetColNames() []string
- func (res ResultSet) GetColSize() int
- func (res ResultSet) GetComment() string
- func (res ResultSet) GetErrorCode() ErrorCode
- func (res ResultSet) GetErrorMsg() string
- func (res ResultSet) GetLatency() int32
- func (res ResultSet) GetPlanDesc() *graph.PlanDescription
- func (res ResultSet) GetRowSize() int
- func (res ResultSet) GetRowValuesByIndex(index int) (*Record, error)
- func (res ResultSet) GetRows() []*nebula.Row
- func (res ResultSet) GetSpaceName() string
- func (res ResultSet) GetValuesByColName(colName string) ([]*ValueWrapper, error)
- func (res ResultSet) IsEmpty() bool
- func (res ResultSet) IsPartialSucceed() bool
- func (res ResultSet) IsSetComment() bool
- func (res ResultSet) IsSetData() bool
- func (res ResultSet) IsSetPlanDesc() bool
- func (res ResultSet) IsSucceed() bool
- func (res ResultSet) MakeDotGraph() string
- func (res ResultSet) MakeDotGraphByStruct() string
- func (res ResultSet) MakePlanByRow() [][]interface{}
- type Session
- type TimeWrapper
- type ValueWrapper
- func (valWrap ValueWrapper) AsBool() (bool, error)
- func (valWrap ValueWrapper) AsDate() (*nebula.Date, error)
- func (valWrap ValueWrapper) AsDateTime() (*DateTimeWrapper, error)
- func (valWrap ValueWrapper) AsDedupList() ([]ValueWrapper, error)
- func (valWrap ValueWrapper) AsFloat() (float64, error)
- func (valWrap ValueWrapper) AsGeography() (*nebula.Geography, error)
- func (valWrap ValueWrapper) AsInt() (int64, error)
- func (valWrap ValueWrapper) AsList() ([]ValueWrapper, error)
- func (valWrap ValueWrapper) AsMap() (map[string]ValueWrapper, error)
- func (valWrap ValueWrapper) AsNode() (*Node, error)
- func (valWrap ValueWrapper) AsNull() (nebula.NullType, error)
- func (valWrap ValueWrapper) AsPath() (*PathWrapper, error)
- func (valWrap ValueWrapper) AsRelationship() (*Relationship, error)
- func (valWrap ValueWrapper) AsString() (string, error)
- func (valWrap ValueWrapper) AsTime() (*TimeWrapper, error)
- func (valWrap ValueWrapper) GetType() string
- func (valWrap ValueWrapper) IsBool() bool
- func (valWrap ValueWrapper) IsDate() bool
- func (valWrap ValueWrapper) IsDateTime() bool
- func (valWrap ValueWrapper) IsEdge() bool
- func (valWrap ValueWrapper) IsEmpty() bool
- func (valWrap ValueWrapper) IsFloat() bool
- func (valWrap ValueWrapper) IsGeography() bool
- func (valWrap ValueWrapper) IsInt() bool
- func (valWrap ValueWrapper) IsList() bool
- func (valWrap ValueWrapper) IsMap() bool
- func (valWrap ValueWrapper) IsNull() bool
- func (valWrap ValueWrapper) IsPath() bool
- func (valWrap ValueWrapper) IsSet() bool
- func (valWrap ValueWrapper) IsString() bool
- func (valWrap ValueWrapper) IsTime() bool
- func (valWrap ValueWrapper) IsVertex() bool
- func (valWrap ValueWrapper) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsError ¶
func IsError(resp *graph.ExecutionResponse) bool
Types ¶
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func NewConnectionPool(addresses []HostAddress, conf PoolConfig, log Logger) (*ConnectionPool, error)
NewConnectionPool constructs a new connection pool using the given addresses and configs
func NewSslConnectionPool ¶ added in v2.6.0
func NewSslConnectionPool(addresses []HostAddress, conf PoolConfig, sslConfig *tls.Config, log Logger) (*ConnectionPool, error)
NewConnectionPool constructs a new SSL connection pool using the given addresses and configs
func (*ConnectionPool) GetSession ¶
func (pool *ConnectionPool) GetSession(username, password string) (*Session, error)
GetSession authenticates the username and password. It returns a session if the authentication succeed.
func (*ConnectionPool) Ping ¶
func (pool *ConnectionPool) Ping(host HostAddress, timeout time.Duration) error
Ping checks avaliability of host
type DateTimeWrapper ¶
type DateTimeWrapper struct {
// contains filtered or unexported fields
}
func (DateTimeWrapper) GetLocalDateTimeWithTimezoneName ¶
func (dt DateTimeWrapper) GetLocalDateTimeWithTimezoneName(timezoneName string) (*nebula.DateTime, error)
GetLocalDateTimeWithTimezoneName returns a nebula.DateTime object representing local time using user specified timezone name.
If the name is "" or "UTC", LoadLocation returns UTC. If the name is "Local", LoadLocation returns Local.
Otherwise, the name is taken to be a location name corresponding to a file in the IANA Time Zone database, such as "America/New_York".
func (DateTimeWrapper) IsEqualTo ¶
func (dt1 DateTimeWrapper) IsEqualTo(dt2 DateTimeWrapper) bool
type DateWrapper ¶
type DateWrapper struct {
// contains filtered or unexported fields
}
func (DateWrapper) IsEqualTo ¶
func (d1 DateWrapper) IsEqualTo(d2 DateWrapper) bool
type DefaultLogger ¶
type DefaultLogger struct{}
func (DefaultLogger) Error ¶
func (l DefaultLogger) Error(msg string)
func (DefaultLogger) Fatal ¶
func (l DefaultLogger) Fatal(msg string)
func (DefaultLogger) Info ¶
func (l DefaultLogger) Info(msg string)
func (DefaultLogger) Warn ¶
func (l DefaultLogger) Warn(msg string)
type ErrorCode ¶
type ErrorCode int64
const ( ErrorCode_SUCCEEDED ErrorCode = ErrorCode(nebula.ErrorCode_SUCCEEDED) ErrorCode_E_DISCONNECTED ErrorCode = ErrorCode(nebula.ErrorCode_E_DISCONNECTED) ErrorCode_E_FAIL_TO_CONNECT ErrorCode = ErrorCode(nebula.ErrorCode_E_FAIL_TO_CONNECT) ErrorCode_E_RPC_FAILURE ErrorCode = ErrorCode(nebula.ErrorCode_E_RPC_FAILURE) ErrorCode_E_BAD_USERNAME_PASSWORD ErrorCode = ErrorCode(nebula.ErrorCode_E_BAD_USERNAME_PASSWORD) ErrorCode_E_SESSION_INVALID ErrorCode = ErrorCode(nebula.ErrorCode_E_SESSION_INVALID) ErrorCode_E_SESSION_TIMEOUT ErrorCode = ErrorCode(nebula.ErrorCode_E_SESSION_TIMEOUT) ErrorCode_E_SYNTAX_ERROR ErrorCode = ErrorCode(nebula.ErrorCode_E_SYNTAX_ERROR) ErrorCode_E_EXECUTION_ERROR ErrorCode = ErrorCode(nebula.ErrorCode_E_EXECUTION_ERROR) ErrorCode_E_STATEMENT_EMPTY ErrorCode = ErrorCode(nebula.ErrorCode_E_STATEMENT_EMPTY) ErrorCode_E_USER_NOT_FOUND ErrorCode = ErrorCode(nebula.ErrorCode_E_USER_NOT_FOUND) ErrorCode_E_BAD_PERMISSION ErrorCode = ErrorCode(nebula.ErrorCode_E_BAD_PERMISSION) ErrorCode_E_SEMANTIC_ERROR ErrorCode = ErrorCode(nebula.ErrorCode_E_SEMANTIC_ERROR) ErrorCode_E_PARTIAL_SUCCEEDED ErrorCode = ErrorCode(nebula.ErrorCode_E_PARTIAL_SUCCEEDED) )
type HostAddress ¶
func DomainToIP ¶
func DomainToIP(addresses []HostAddress) ([]HostAddress, error)
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (Node) Properties ¶
func (node Node) Properties(tagName string) (map[string]*ValueWrapper, error)
Properties returns all properties of a tag
type PathWrapper ¶
type PathWrapper struct {
// contains filtered or unexported fields
}
func (*PathWrapper) ContainsNode ¶
func (path *PathWrapper) ContainsNode(node Node) bool
func (*PathWrapper) ContainsRelationship ¶
func (path *PathWrapper) ContainsRelationship(relationship *Relationship) bool
func (*PathWrapper) GetEndNode ¶
func (path *PathWrapper) GetEndNode() (*Node, error)
func (*PathWrapper) GetNodes ¶
func (path *PathWrapper) GetNodes() []*Node
func (*PathWrapper) GetPathLength ¶
func (path *PathWrapper) GetPathLength() int
func (*PathWrapper) GetRelationships ¶
func (path *PathWrapper) GetRelationships() []*Relationship
func (*PathWrapper) GetSegments ¶
func (path *PathWrapper) GetSegments() []segment
func (*PathWrapper) GetStartNode ¶
func (path *PathWrapper) GetStartNode() (*Node, error)
func (*PathWrapper) IsEqualTo ¶
func (p1 *PathWrapper) IsEqualTo(p2 *PathWrapper) bool
func (*PathWrapper) String ¶
func (pathWrap *PathWrapper) String() string
Path format: <("VertexID" :tag1{k0: v0,k1: v1}) -[:TypeName@ranking {edgeProps}]-> ("VertexID2" :tag1{k0: v0,k1: v1} :tag2{k2: v2}) -[:TypeName@ranking {edgeProps}]-> ("VertexID3" :tag1{k0: v0,k1: v1})>
type PoolConfig ¶
type PoolConfig struct { // Socket timeout and Socket connection timeout, unit: seconds TimeOut time.Duration // The idleTime of the connection, unit: seconds // If connection's idle time is longer than idleTime, it will be delete // 0 value means the connection will not expire IdleTime time.Duration // The max connections in pool for all addresses MaxConnPoolSize int // The min connections in pool for all addresses MinConnPoolSize int }
PoolConfig is the configs of connection pool
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
func (Record) GetValueByColName ¶
func (record Record) GetValueByColName(colName string) (*ValueWrapper, error)
Returns value in the record at given column name
func (Record) GetValueByIndex ¶
func (record Record) GetValueByIndex(index int) (*ValueWrapper, error)
Returns value in the record at given column index
type Relationship ¶
type Relationship struct {
// contains filtered or unexported fields
}
func (Relationship) GetDstVertexID ¶
func (relationship Relationship) GetDstVertexID() ValueWrapper
func (Relationship) GetEdgeName ¶
func (relationship Relationship) GetEdgeName() string
func (Relationship) GetRanking ¶
func (relationship Relationship) GetRanking() int64
func (Relationship) GetSrcVertexID ¶
func (relationship Relationship) GetSrcVertexID() ValueWrapper
func (Relationship) IsEqualTo ¶
func (r1 Relationship) IsEqualTo(r2 *Relationship) bool
func (Relationship) Keys ¶
func (relationship Relationship) Keys() []string
Keys returns a list of keys
func (Relationship) Properties ¶
func (relationship Relationship) Properties() map[string]*ValueWrapper
Properties returns a map where the key is property name and the value is property name
func (Relationship) String ¶
func (relationship Relationship) String() string
String returns a string representing relationship Relationship format: [:edge src->dst @ranking {props}]
func (Relationship) Values ¶
func (relationship Relationship) Values() []*ValueWrapper
Values returns a list of values wrapped as ValueWrappers
type ResultSet ¶
type ResultSet struct {
// contains filtered or unexported fields
}
func (ResultSet) AsStringTable ¶
Returns a 2D array of strings representing the query result If resultSet.resp.data is nil, returns an empty 2D array
func (ResultSet) GetColNames ¶
func (ResultSet) GetColSize ¶
Returns the number of total columns
func (ResultSet) GetComment ¶
func (ResultSet) GetErrorCode ¶
Returns an integer representing an error type 0 ErrorCode_SUCCEEDED -1 ErrorCode_E_DISCONNECTED -2 ErrorCode_E_FAIL_TO_CONNECT -3 ErrorCode_E_RPC_FAILURE -4 ErrorCode_E_BAD_USERNAME_PASSWORD -5 ErrorCode_E_SESSION_INVALID -6 ErrorCode_E_SESSION_TIMEOUT -7 ErrorCode_E_SYNTAX_ERROR -8 ErrorCode_E_EXECUTION_ERROR -9 ErrorCode_E_STATEMENT_EMPTY -10 ErrorCode_E_USER_NOT_FOUND -11 ErrorCode_E_BAD_PERMISSION -12 ErrorCode_E_SEMANTIC_ERROR
func (ResultSet) GetErrorMsg ¶
func (ResultSet) GetLatency ¶
func (ResultSet) GetPlanDesc ¶
func (res ResultSet) GetPlanDesc() *graph.PlanDescription
func (ResultSet) GetRowSize ¶
Returns the number of total rows
func (ResultSet) GetRowValuesByIndex ¶
Returns all values in the row at given index
func (ResultSet) GetSpaceName ¶
func (ResultSet) GetValuesByColName ¶
func (res ResultSet) GetValuesByColName(colName string) ([]*ValueWrapper, error)
Returns all values in the given column
func (ResultSet) IsPartialSucceed ¶
func (ResultSet) IsSetComment ¶
func (ResultSet) IsSetPlanDesc ¶
func (ResultSet) MakeDotGraph ¶
explain/profile format="dot"
func (ResultSet) MakeDotGraphByStruct ¶
explain/profile format="dot:struct"
func (ResultSet) MakePlanByRow ¶
func (res ResultSet) MakePlanByRow() [][]interface{}
explain/profile format="row"
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) ExecuteJson ¶ added in v2.6.0
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": "" } ] }
type TimeWrapper ¶
type TimeWrapper struct {
// contains filtered or unexported fields
}
func (TimeWrapper) IsEqualTo ¶
func (t1 TimeWrapper) IsEqualTo(t2 TimeWrapper) bool
type ValueWrapper ¶
type ValueWrapper struct {
// contains filtered or unexported fields
}
func (ValueWrapper) AsBool ¶
func (valWrap ValueWrapper) AsBool() (bool, error)
AsBool converts the ValueWrapper to a boolean value
func (ValueWrapper) AsDate ¶
func (valWrap ValueWrapper) AsDate() (*nebula.Date, error)
AsDate converts the ValueWrapper to a nebula.Date
func (ValueWrapper) AsDateTime ¶
func (valWrap ValueWrapper) AsDateTime() (*DateTimeWrapper, error)
AsDateTime converts the ValueWrapper to a DateTimeWrapper
func (ValueWrapper) AsDedupList ¶
func (valWrap ValueWrapper) AsDedupList() ([]ValueWrapper, error)
AsDedupList converts the ValueWrapper to a slice of ValueWrapper that has unique elements
func (ValueWrapper) AsFloat ¶
func (valWrap ValueWrapper) AsFloat() (float64, error)
AsFloat converts the ValueWrapper to a float64
func (ValueWrapper) AsGeography ¶ added in v2.6.0
func (valWrap ValueWrapper) AsGeography() (*nebula.Geography, error)
AsPath converts the ValueWrapper to a nebula.Geography
func (ValueWrapper) AsInt ¶
func (valWrap ValueWrapper) AsInt() (int64, error)
AsInt converts the ValueWrapper to an int64
func (ValueWrapper) AsList ¶
func (valWrap ValueWrapper) AsList() ([]ValueWrapper, error)
AsList converts the ValueWrapper to a slice of ValueWrapper
func (ValueWrapper) AsMap ¶
func (valWrap ValueWrapper) AsMap() (map[string]ValueWrapper, error)
AsMap converts the ValueWrapper to a map of string and ValueWrapper
func (ValueWrapper) AsNode ¶
func (valWrap ValueWrapper) AsNode() (*Node, error)
AsNode converts the ValueWrapper to a Node
func (ValueWrapper) AsNull ¶
func (valWrap ValueWrapper) AsNull() (nebula.NullType, error)
AsNull converts the ValueWrapper to nebula.NullType
func (ValueWrapper) AsPath ¶
func (valWrap ValueWrapper) AsPath() (*PathWrapper, error)
AsPath converts the ValueWrapper to a PathWrapper
func (ValueWrapper) AsRelationship ¶
func (valWrap ValueWrapper) AsRelationship() (*Relationship, error)
AsRelationship converts the ValueWrapper to a Relationship
func (ValueWrapper) AsString ¶
func (valWrap ValueWrapper) AsString() (string, error)
AsString converts the ValueWrapper to a String
func (ValueWrapper) AsTime ¶
func (valWrap ValueWrapper) AsTime() (*TimeWrapper, error)
AsTime converts the ValueWrapper to a TimeWrapper
func (ValueWrapper) GetType ¶
func (valWrap ValueWrapper) GetType() string
GetType returns the value type of value in the valWrap as a string
func (ValueWrapper) IsBool ¶
func (valWrap ValueWrapper) IsBool() bool
func (ValueWrapper) IsDate ¶
func (valWrap ValueWrapper) IsDate() bool
func (ValueWrapper) IsDateTime ¶
func (valWrap ValueWrapper) IsDateTime() bool
func (ValueWrapper) IsEdge ¶
func (valWrap ValueWrapper) IsEdge() bool
func (ValueWrapper) IsEmpty ¶
func (valWrap ValueWrapper) IsEmpty() bool
func (ValueWrapper) IsFloat ¶
func (valWrap ValueWrapper) IsFloat() bool
func (ValueWrapper) IsGeography ¶ added in v2.6.0
func (valWrap ValueWrapper) IsGeography() bool
func (ValueWrapper) IsInt ¶
func (valWrap ValueWrapper) IsInt() bool
func (ValueWrapper) IsList ¶
func (valWrap ValueWrapper) IsList() bool
func (ValueWrapper) IsMap ¶
func (valWrap ValueWrapper) IsMap() bool
func (ValueWrapper) IsNull ¶
func (valWrap ValueWrapper) IsNull() bool
func (ValueWrapper) IsPath ¶
func (valWrap ValueWrapper) IsPath() bool
func (ValueWrapper) IsSet ¶
func (valWrap ValueWrapper) IsSet() bool
func (ValueWrapper) IsString ¶
func (valWrap ValueWrapper) IsString() bool
func (ValueWrapper) IsTime ¶
func (valWrap ValueWrapper) IsTime() bool
func (ValueWrapper) IsVertex ¶
func (valWrap ValueWrapper) IsVertex() bool
func (ValueWrapper) String ¶
func (valWrap ValueWrapper) String() string
String() returns the value in the ValueWrapper as a 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 time, and dateTime, String returns the value calculated using the timezone offset from graph service by default.