nebula_sirius

package module
v1.0.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

README

photo_2.jpg


CI Go Report Card GitHub tag (latest SemVer) GitHub stars

License GoDoc

nebula-sirius is a Go library that provides a simple and efficient way to interact with the Nebula Graph database. It allows you to connect to Nebula Graph, execute queries, and retrieve results.


Why do we need nebula-sirius?

In many applications, interacting with the Nebula Graph database can be complex. nebula-sirius simplifies this process by providing a standardized way to connect to Nebula Graph, execute queries, and retrieve results. This library is particularly useful in building applications that need to interact with the Nebula Graph database.

What makes current project different from nebula-go

The motivation behind creating a new client SDK for the Nebula Graph database is as follows:

  • Robust Connection Pooling: Current resource management is done poorly in the current nebula-go, which is written in a scratch way. nebula-sirius introduces connection pooling for robust resource management via library, go-commons-pool.
  • Context Cancellation: Better control over requests and handling graceful shutdowns, which is a missing feature in the current nebula-go. nebula-sirius supports context cancellation for improved request handling.
  • Utilization of different code-generator: Utilized apache/thrift for code generation, which is more feature rich than the current nebula-go's code-generator which is vesoft-inc/fbthrift.

To bring these features into nebula-go would cause breaking changes, which is critical for projects that currently rely on it. Therefore, we decided to re-write it with a different name, nebula-sirius, and release it.

Installation

To install nebula-sirius into your project, use the following command:

go get github.com/nebula-contrib/nebula-sirius

Usage

To use nebula-sirius, simply import the library and create a new instance of the GraphClient struct.

Here is the restructured Usage section with multiple code snippets for easier understanding:

Usage

Step 1: Configure the Nebula Client Factory

First, we need to configure the Nebula Client Factory with the provided configuration.

clientFactory := nebula_sirius.NewNebulaClientFactory(
	&nebula_sirius.NebulaClientConfig{
		HostAddress: nebula_sirius.HostAddress{
			Host: nebulagraph_light_deployment.HostGraphD,
			Port: nebulagraph_light_deployment.PortGraphD,
		},
	},
	nebula_sirius.DefaultLogger{},
)
Step 2: Create a Pool of Nebula Clients

Next, we create a pool of Nebula clients based on the client factory and pool configuration. P:S for full reference of ObjectPoolConfig, please refer to go-commons-pool documentation

nebulaClientPool := pool.NewObjectPool(
	ctx,
	clientFactory,
	&pool.ObjectPoolConfig{
		MaxIdle:  5,
		MaxTotal: 10,
		//MaxWaitMillis: 1000,
	},
)
Step 3: Borrow a Thrift Client from the Pool

We then borrow a Thrift client from the pool.

clientObj, err := nebulaClientPool.BorrowObject(ctx)
if err != nil {
	log.Fatalf("Error borrowing object from pool: %s", err)
}
Step 4: Get the Graph Client

We take the GraphClient to execute Nebula queries on the Nebula graph service.

g, err := client.GraphClient()
if err != nil {
	log.Fatalf("Error getting graph client: %v", err)
}
Step 5: Authenticate with the Nebula Database

We make an authentication request to the Nebula database.

a, err := g.Authenticate(
	ctx,
	[]byte(nebulagraph_light_deployment.USERNAME),
	[]byte(nebulagraph_light_deployment.PASSWORD),
)
if err != nil {
	log.Fatalf("Error executing query via graph client: %v", err)
}
Step 6: Execute a Query

Finally, we execute a query using the GraphClient.

nglQuery := `SHOW HOSTS;`
a1, err := g.Execute(ctx, *a.SessionID, []byte(nglQuery))
if err != nil || a1.GetErrorCode() != nebula.ErrorCode_SUCCEEDED{
	log.Fatalf("Error executing query via graph client: %v %s", err, a1.ErrorMsg)
}
Step 7: Print the Result Set

We print the result set of the query.

log.Println(nebula_sirius.GenResultSet(a1))

Examples

You may refer the working samples located under examples folder.

Contribution

We welcome contributions to nebula-sirius. If you're interested in contributing, please follow these steps:

  1. Fork the repository on GitHub.
  2. Create a new branch for your feature or bug fix.
  3. Write tests for your changes.
  4. Submit a pull request.

LICENSE

Note

This project includes code copied and pasted from the Nebula Go repository (https://github.com/vesoft-inc/nebula-go). The original code is licensed under the Apache License 2.0, and we acknowledge the original authors of this code.

nebula-sirius is released under the Apache 2.0 License.

Code of Conduct

We follow the Go community's Code of Conduct. Please read it before contributing.

Support

If you have any questions or need help with nebula-sirius, please open an issue on GitHub.

Thank you for using nebula-sirius!

Documentation

Index

Constants

View Source
const (
	ErrorTagNotFound  = "TagNotFound: Tag not existed!"
	ErrorEdgeNotFound = "EdgeNotFound: Edge not existed!"
)

Variables

This section is empty.

Functions

func DefaultClientNameGenerator

func DefaultClientNameGenerator(ctx context.Context) (string, error)

DefaultClientNameGenerator is a default implementation of ClientNameGenerator. It generates a random hex string of length 10 and prefix it with "NebulaClient_". The generated name is used to identify the client in the logs.

func GetDefaultSSLConfig

func GetDefaultSSLConfig(rootCAPath, certPath, privateKeyPath string) (*tls.Config, error)

GetDefaultSSLConfig reads the files in the given path and returns a tls.Config object

func MakeOperatorInfo

func MakeOperatorInfo(planNodeDesc *graph.PlanNodeDescription) string

generate operator info for Row format.

func MakeProfilingData

func MakeProfilingData(planNodeDesc *graph.PlanNodeDescription, isTckFmt bool) (string, error)

MakeProfilingData generate profiling data for both Row and TCK formats.

Types

type ClientNameGeneratorFunc

type ClientNameGeneratorFunc func(ctx context.Context) (string, error)

ClientNameGeneratorFunc is a function that generates a client name based on the context.

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) Debug

func (l DefaultLogger) Debug(msg string)

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

type HostAddress struct {
	Host string
	Port int
}

type Logger

type Logger interface {
	Info(msg string)
	Warn(msg string)
	Debug(msg string)
	Error(msg string)
	Fatal(msg string)
}

type NebulaClientConfig

type NebulaClientConfig struct {
	// UseHTTP2 indicates whether to use HTTP2
	UseHTTP2 bool

	// HttpHeader is the http headers for the connection when using HTTP2
	HttpHeader http.Header

	// client handshakeKey, make sure the client handshakeKey is in the white list of NebulaGraph server 'client_white_list'
	HandshakeKey string

	SslConfig *tls.Config

	// HostAddress represents network address as host and port
	HostAddress HostAddress

	// Socket timeout and Socket connection timeout, unit: seconds
	Timeout time.Duration
}

NebulaClientConfig represents the configuration for the Nebula client.

type NebulaClientFactory

type NebulaClientFactory struct {
	// contains filtered or unexported fields
}

NebulaClientFactory represents a factory for creating new instances of the Nebula client.

The factory is configured using the provided NebulaClientConfig and a logger. The logger is used to log any errors that occur while creating or using the client instances. The client name generator function is used to generate a client name for each instance of the Nebula client.

func InitNebulaClientFactoryWithDefault

func InitNebulaClientFactoryWithDefault(conf *NebulaClientConfig) *NebulaClientFactory

InitNebulaClientFactoryWithDefault creates a new NebulaClientFactory with the given configuration and a default logger.

The returned factory can be used to create new instances of the Nebula client, which can be used to interact with the Nebula graph database.

The given configuration will be used to initialize the new client instances. The default logger will be used to log any errors that occur while creating or using the client instances.

func NewNebulaClientFactory

func NewNebulaClientFactory(conf *NebulaClientConfig, log Logger, genClientNameFunc ClientNameGeneratorFunc) *NebulaClientFactory

NewNebulaClientFactory creates a new NebulaClientFactory with the given configuration and logger.

The returned factory can be used to create new instances of the Nebula client, which can be used to interact with the Nebula graph database.

The given configuration will be used to initialize the new client instances. The logger will be used to log any errors that occur while creating or using the client instances.

func (*NebulaClientFactory) ActivateObject

func (f *NebulaClientFactory) ActivateObject(ctx context.Context, object *pool.PooledObject) error

ActivateObject is called when an object is borrowed from the pool. It may be used to reset or initialize the connection. In this case, it will open the transport if it is not already open, and then verify the client version.

func (*NebulaClientFactory) DestroyObject

func (f *NebulaClientFactory) DestroyObject(ctx context.Context, object *pool.PooledObject) error

DestroyObject is the implementation of the ObjectFactory interface method.

This method is responsible for destroying a pooled object. It closes the transport of the underlying WrappedNebulaClient, effectively terminating the connection to the Nebula graph database.

The ctx context is not used directly in this method but is included to satisfy the interface requirements.

Returns an error if there is a failure in closing the transport.

func (*NebulaClientFactory) GetClientNameGenerator

func (f *NebulaClientFactory) GetClientNameGenerator() ClientNameGeneratorFunc

GetClientNameGenerator returns the client name generator function

func (*NebulaClientFactory) MakeObject

func (f *NebulaClientFactory) MakeObject(ctx context.Context) (*pool.PooledObject, error)

MakeObject is the implementation of the ObjectFactory interface method.

This method will create a new instance of the Nebula client using the configuration provided when creating the factory.

The returned PooledObject will contain the newly created client and can be used to interact with the Nebula graph database.

The ctx context will be used to generate the client instance. If the context is canceled before the client instance is generated, the method will return an error.

func (*NebulaClientFactory) PassivateObject

func (f *NebulaClientFactory) PassivateObject(ctx context.Context, object *pool.PooledObject) error

PassivateObject is called when an object is returned to the pool.

It may be used to reset or close the connection. In this case, it will close the transport if it is already open.

func (*NebulaClientFactory) ValidateObject

func (f *NebulaClientFactory) ValidateObject(ctx context.Context, object *pool.PooledObject) bool

ValidateObject checks whether the given object is valid or not.

The "validity" of an object is determined by whether its underlying transport is open or not.

This is used by the pool to remove dead connections from the pool.

type Node

type Node struct {
	// contains filtered or unexported fields
}

func (Node) GetID

func (node Node) GetID() ValueWrapper

GetID returns a list of vid of node

func (Node) GetTags

func (node Node) GetTags() []string

GetTags returns a list of tag names of node

func (Node) HasTag

func (node Node) HasTag(label string) bool

HasTag checks if node contains given label

func (Node) IsEqualTo

func (n1 Node) IsEqualTo(n2 *Node) bool

IsEqualTo Returns true if two nodes have same vid

func (Node) Keys

func (node Node) Keys(tagName string) ([]string, error)

Keys returns all prop names of the given tag name

func (Node) Properties

func (node Node) Properties(tagName string) (map[string]*ValueWrapper, error)

Properties returns all properties of a tag

func (Node) String

func (node Node) String() string

String returns a string representing node Node format: ("VertexID" :tag1{k0: v0,k1: v1}:tag2{k2: v2})

func (Node) Values

func (node Node) Values(tagName string) ([]*ValueWrapper, error)

Values returns all prop values of the given tag name

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 Record

type Record struct {
	// contains filtered or unexported fields
}

func (Record) GetValueByColName

func (record Record) GetValueByColName(colName string) (*ValueWrapper, error)

GetValueByColName Returns value in the record at given column name

func (Record) GetValueByIndex

func (record Record) GetValueByIndex(index int) (*ValueWrapper, error)

GetValueByIndex Returns value in the record at given column index

func (Record) String

func (record Record) String() string

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 GenResultSet

func GenResultSet(resp *graph.ExecutionResponse) (*ResultSet, error)

func (ResultSet) AsStringTable

func (res ResultSet) AsStringTable() [][]string

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 (res ResultSet) GetColNames() []string

func (ResultSet) GetColSize

func (res ResultSet) GetColSize() int

GetColSize Returns the number of total columns

func (ResultSet) GetComment

func (res ResultSet) GetComment() string

func (ResultSet) GetErrorCode

func (res ResultSet) GetErrorCode() ErrorCode

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 (res ResultSet) GetErrorMsg() string

func (ResultSet) GetLatency

func (res ResultSet) GetLatency() int64

func (ResultSet) GetLatencyInMs

func (res ResultSet) GetLatencyInMs() int64

func (ResultSet) GetPlanDesc

func (res ResultSet) GetPlanDesc() *graph.PlanDescription

func (ResultSet) GetRowSize

func (res ResultSet) GetRowSize() int

GetRowSize Returns the number of total rows

func (ResultSet) GetRowValuesByIndex

func (res ResultSet) GetRowValuesByIndex(index int) (*Record, error)

GetRowValuesByIndex Returns all values in the row at given index

func (ResultSet) GetRows

func (res ResultSet) GetRows() []*nebula.Row

GetRows Returns all rows

func (ResultSet) GetSpaceName

func (res ResultSet) GetSpaceName() string

func (ResultSet) GetValuesByColName

func (res ResultSet) GetValuesByColName(colName string) ([]*ValueWrapper, error)

GetValuesByColName Returns all values in the given column

func (ResultSet) IsEmpty

func (res ResultSet) IsEmpty() bool

func (ResultSet) IsPartialSucceed

func (res ResultSet) IsPartialSucceed() bool

func (ResultSet) IsSetComment

func (res ResultSet) IsSetComment() bool

func (ResultSet) IsSetData

func (res ResultSet) IsSetData() bool

func (ResultSet) IsSetPlanDesc

func (res ResultSet) IsSetPlanDesc() bool

func (ResultSet) IsSucceed

func (res ResultSet) IsSucceed() bool

func (ResultSet) MakeDotGraph

func (res ResultSet) MakeDotGraph() string

explain/profile format="dot"

func (ResultSet) MakeDotGraphByStruct

func (res ResultSet) MakeDotGraphByStruct() string

explain/profile format="dot:struct"

func (ResultSet) MakePlanByRow

func (res ResultSet) MakePlanByRow() ([][]interface{}, error)

MakePlanByRow explain/profile format="row"

func (ResultSet) MakePlanByTck

func (res ResultSet) MakePlanByTck() ([][]interface{}, error)

MakePlanByTck explain/profile format="tck"

func (ResultSet) Scan

func (res ResultSet) Scan(v interface{}) error

Scan scans the rows into the given value.

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) AsDuration

func (valWrap ValueWrapper) AsDuration() (*nebula.Duration, error)

AsDuration converts the ValueWrapper to a DurationWrapper

func (ValueWrapper) AsFloat

func (valWrap ValueWrapper) AsFloat() (float64, error)

AsFloat converts the ValueWrapper to a float64

func (ValueWrapper) AsGeography

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) IsDuration

func (valWrap ValueWrapper) IsDuration() 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

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 vertex, 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.

type WrappedNebulaClient

type WrappedNebulaClient struct {
	// contains filtered or unexported fields
}

WrappedNebulaClient represents a client for interacting with the Nebula graph database.

It encapsulates the graph, meta, and storage service clients, along with the transport layer and logging functionality. The client can be configured using the provided NebulaClientConfig and logs errors and other information using the specified Logger.

func (*WrappedNebulaClient) Close

func (wc *WrappedNebulaClient) Close() error

Close closes the underlying transport. It is safe to call this method multiple times.

func (*WrappedNebulaClient) GetClientName

func (wc *WrappedNebulaClient) GetClientName() string

GetClientName returns the name of the client.

func (*WrappedNebulaClient) GetTransport

func (wc *WrappedNebulaClient) GetTransport() thrift.TTransport

GetTransport returns the underlying transport.

func (*WrappedNebulaClient) GraphClient

func (wc *WrappedNebulaClient) GraphClient() (graph.GraphService, error)

GraphClient returns the graph client

func (*WrappedNebulaClient) MetaClient

func (wc *WrappedNebulaClient) MetaClient() (meta.MetaService, error)

MetaClient returns the meta client

func (*WrappedNebulaClient) StorageClient

func (wc *WrappedNebulaClient) StorageClient() (storage.GraphStorageService, error)

StorageClient returns the storage client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL