Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) AddE(label string, from, to interface{}) ([]*GremlinRespData, error)
- func (c *Client) AddEById(label string, from, to uuid.UUID) ([]*GremlinRespData, error)
- func (c *Client) AddEWithProps(label string, from, to interface{}, props map[string]interface{}) ([]*GremlinRespData, error)
- func (c *Client) AddEWithPropsById(label string, from, to uuid.UUID, props map[string]interface{}) ([]*GremlinRespData, error)
- func (c *Client) AddV(label string, data interface{}) ([]*GremlinRespData, error)
- func (c *Client) Close()
- func (c *Client) DropE(label string, from, to interface{}) ([]*GremlinRespData, error)
- func (c *Client) DropEById(label string, from, to uuid.UUID) ([]*GremlinRespData, error)
- func (c *Client) DropV(data interface{}) ([]*GremlinRespData, error)
- func (c *Client) Execute(query string, bindings, rebindings map[string]interface{}) ([]*GremlinRespData, error)
- func (c *Client) Get(query string, bindings map[string]interface{}, ptr interface{}) error
- func (c *Client) IsConnected() bool
- func (c *Client) Reconnect()
- func (c *Client) UpdateV(data interface{}) ([]*GremlinRespData, error)
- type ClientConfig
- func (conf *ClientConfig) SetAuthentication(username string, password string)
- func (conf *ClientConfig) SetDebug()
- func (conf *ClientConfig) SetLogger(logger *logger.Logger)
- func (conf *ClientConfig) SetPingInterval(seconds int)
- func (conf *ClientConfig) SetReadingWait(seconds int)
- func (conf *ClientConfig) SetTimeout(seconds int)
- func (conf *ClientConfig) SetVerbose()
- func (conf *ClientConfig) SetWritingWait(seconds int)
- type GremlinData
- type GremlinProperty
- type GremlinRequest
- type GremlinRespData
- type GremlinResponse
- type GremlinResult
- type GremlinStatus
- type GremlinStatusAttributes
- type Ws
Constants ¶
This section is empty.
Variables ¶
var ( ErrorInterfaceHasNoIdField = errors.New("gremgoser: the passed interface must have an Id field") ErrorNoGraphTags = errors.New("gremgoser: the passed interface has no graph tags") ErrorUnsupportedPropertyMap = errors.New("gremgoser: unsupported property map") ErrorCannotCastProperty = errors.New("gremgoser: passed property cannot be cast") ErrorWSConnection = errors.New("gremgoser: error connecting to websocket") ErrorWSConnectionNil = errors.New("gremgoser: error websocket connection nil") ErrorConnectionDisposed = errors.New("gremgoser: you cannot write on a disposed connection") ErrorInvalidURI = errors.New("gremgoser: invalid uri supplied in config") ErrorNoAuth = errors.New("gremgoser: client does not have a secure dialer for authentication with the server") Error407Authenticate = errors.New("gremgoser: AUTHENTICATE") Error498MalformedRequest = errors.New("gremgoser: MALFORMED REQUEST") Error499InvalidRequestArguments = errors.New("gremgoser: INVALID REQUEST ARGUMENTS") Error500ServerError = errors.New("gremgoser: SERVER ERROR") Error597ScriptEvaluationError = errors.New("gremgoser: SCRIPT EVALUATION ERROR") Error598ServerTimeout = errors.New("gremgoser: SERVER TIMEOUT") Error599ServerSerializationError = errors.New("gremgoser: SERVER SERIALIZATION ERROR") ErrorUnknownCode = errors.New("gremgoser: UNKNOWN ERROR") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Errored bool // contains filtered or unexported fields }
Client is a container for the gremgoser client.
func NewClient ¶
func NewClient(conf *ClientConfig) (*Client, chan error)
NewClient returns a gremgoser client for interaction with the Gremlin Server specified in the host IP.
func (*Client) AddE ¶
func (c *Client) AddE(label string, from, to interface{}) ([]*GremlinRespData, error)
AddE takes a label, from UUID and to UUID then creates a edge between the two vertex in the graph
func (*Client) AddEById ¶
AddEById takes a label, from UUID and to UUID then creates a edge between the two vertex in the graph
func (*Client) AddEWithProps ¶
func (c *Client) AddEWithProps(label string, from, to interface{}, props map[string]interface{}) ([]*GremlinRespData, error)
AddEWithProps takes a label, from UUID and to UUID then creates a edge between the two vertex in the graph
func (*Client) AddEWithPropsById ¶
func (c *Client) AddEWithPropsById(label string, from, to uuid.UUID, props map[string]interface{}) ([]*GremlinRespData, error)
AddEWithPropsById takes a label, from UUID and to UUID then creates a edge between the two vertex in the graph
func (*Client) AddV ¶
func (c *Client) AddV(label string, data interface{}) ([]*GremlinRespData, error)
AddV takes a label and a interface and adds it a vertex to the graph
func (*Client) Close ¶
func (c *Client) Close()
Close closes the underlying connection and marks the client as closed.
func (*Client) DropE ¶
func (c *Client) DropE(label string, from, to interface{}) ([]*GremlinRespData, error)
DropE takes a label, from UUID and to UUID then drops the edge between the two vertex in the graph
func (*Client) DropEById ¶
DropEById takes a label, from UUID and to UUID then drops the edge between the two vertex in the graph
func (*Client) DropV ¶
func (c *Client) DropV(data interface{}) ([]*GremlinRespData, error)
DropV takes a interface and drops the vertex from the graph
func (*Client) Execute ¶
func (c *Client) Execute(query string, bindings, rebindings map[string]interface{}) ([]*GremlinRespData, error)
Execute formats a raw Gremlin query, sends it to Gremlin Server, and returns the result.
func (*Client) Get ¶
Get formats a raw Gremlin query, sends it to Gremlin Server, and populates the passed []interface.
func (*Client) Reconnect ¶
func (c *Client) Reconnect()
Reconnect tries to reconnect the underlying ws connection
func (*Client) UpdateV ¶
func (c *Client) UpdateV(data interface{}) ([]*GremlinRespData, error)
UpdateV takes a interface and updates the vertex in the graph
type ClientConfig ¶
type ClientConfig struct { URI string AuthReq *GremlinRequest Debug bool Verbose bool VeryVerbose bool Timeout time.Duration PingInterval time.Duration WritingWait time.Duration ReadingWait time.Duration Logger *logger.Logger }
ClientConfig configs a client
func NewClientConfig ¶
func NewClientConfig(uri string) *ClientConfig
NewClientConfig returns a default client config
func (*ClientConfig) SetAuthentication ¶
func (conf *ClientConfig) SetAuthentication(username string, password string)
SetAuthentication sets on dialer credentials for authentication
func (*ClientConfig) SetLogger ¶
func (conf *ClientConfig) SetLogger(logger *logger.Logger)
SetLogger sets the default logger
func (*ClientConfig) SetPingInterval ¶
func (conf *ClientConfig) SetPingInterval(seconds int)
SetPingInterval sets the interval of ping sending for know is connection is alive and in consequence the client is connected
func (*ClientConfig) SetReadingWait ¶
func (conf *ClientConfig) SetReadingWait(seconds int)
SetReadingWait sets the time for waiting that reading occur
func (*ClientConfig) SetTimeout ¶
func (conf *ClientConfig) SetTimeout(seconds int)
SetTimeout sets the dial timeout
func (*ClientConfig) SetVerbose ¶
func (conf *ClientConfig) SetVerbose()
SetVerbose sets the verbose flag
func (*ClientConfig) SetWritingWait ¶
func (conf *ClientConfig) SetWritingWait(seconds int)
SetWritingWait sets the time for waiting that writing occur
type GremlinData ¶
type GremlinProperty ¶
type GremlinRequest ¶
type GremlinRequest struct { RequestId uuid.UUID `json:"requestId,string"` Op string `json:"op"` Processor string `json:"processor"` Args map[string]interface{} `json:"args"` }
GremlinRequest is a container for all evaluation request parameters to be sent to the Gremlin Server.
type GremlinRespData ¶
type GremlinRespData map[string]interface{}
type GremlinResponse ¶
type GremlinResponse struct { RequestId uuid.UUID `json:"requestId,string"` Status GremlinStatus `json:"status"` Result GremlinResult `json:"result"` }
type GremlinResult ¶
type GremlinResult struct { Data []*GremlinRespData `json:"data"` Meta interface{} `json:"meta"` }
type GremlinStatus ¶
type GremlinStatus struct { Code int `json:"code"` Attributes GremlinStatusAttributes `json:"attributes"` Message string `json:"message"` }
type GremlinStatusAttributes ¶
type GremlinStatusAttributes struct { XMsStatusCode int `json:"x-ms-status-code"` XMsRequestCharge float32 `json:"x-ms-request-charge"` XMsTotalRequestCharge float32 `json:"x-ms-total-request-charge"` XMsServerTimeMs float32 `json:"x-ms-server-time-ms"` XMsTotalServerTimeMs float32 `json:"x-ms-total-server-time-ms"` XMsActivityId uuid.UUID `json:"x-ms-activity-id"` }