Documentation ¶
Index ¶
- type AsyncResponse
- type Client
- func (c *Client) Close()
- func (c *Client) Execute(query string) (resp []Response, err error)
- func (c *Client) ExecuteAsync(query string, responseChannel chan AsyncResponse) (err error)
- func (c *Client) ExecuteFile(path string) (resp []Response, err error)
- func (c *Client) ExecuteFileWithBindings(path string, bindings, rebindings map[string]string) (resp []Response, err error)
- func (c *Client) ExecuteWithBindings(query string, bindings, rebindings map[string]string) (resp []Response, err error)
- type DialerConfig
- func SetAuthentication(username string, password string) DialerConfig
- func SetBufferSize(readBufferSize int, writeBufferSize int) DialerConfig
- func SetPingInterval(seconds int) DialerConfig
- func SetReadingWait(seconds int) DialerConfig
- func SetTimeout(seconds int) DialerConfig
- func SetWritingWait(seconds int) DialerConfig
- type Pool
- type PooledConnection
- type Response
- type Result
- type Status
- type Ws
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncResponse ¶
type AsyncResponse struct { Response Response `json:"response"` //Partial Response object ErrorMessage string `json:"errorMessage"` // Error message if there was an error }
AsyncResponse structs holds the entire response from requests to the gremlin server
type Client ¶
Client is a container for the gremtune client.
func Dial ¶
Dial returns a gremtune client for interaction with the Gremlin Server specified in the host IP.
func (*Client) Close ¶
func (c *Client) Close()
Close closes the underlying connection and marks the client as closed.
func (*Client) Execute ¶
Execute formats a raw Gremlin query, sends it to Gremlin Server, and returns the result.
func (*Client) ExecuteAsync ¶
func (c *Client) ExecuteAsync(query string, responseChannel chan AsyncResponse) (err error)
Execute formats a raw Gremlin query, sends it to Gremlin Server, and the results are streamed to channel provided in method paramater.
func (*Client) ExecuteFile ¶
ExecuteFile takes a file path to a Gremlin script, sends it to Gremlin Server, and returns the result.
type DialerConfig ¶
type DialerConfig func(*Ws)
DialerConfig is the struct for defining configuration for WebSocket dialer
func SetAuthentication ¶
func SetAuthentication(username string, password string) DialerConfig
SetAuthentication sets on dialer credentials for authentication
func SetBufferSize ¶
func SetBufferSize(readBufferSize int, writeBufferSize int) DialerConfig
SetBufferSize sets the read/write buffer size
func SetPingInterval ¶
func SetPingInterval(seconds int) DialerConfig
SetPingInterval sets the interval of ping sending for know is connection is alive and in consequence the client is connected
func SetReadingWait ¶
func SetReadingWait(seconds int) DialerConfig
SetReadingWait sets the time for waiting that reading occur
func SetWritingWait ¶
func SetWritingWait(seconds int) DialerConfig
SetWritingWait sets the time for waiting that writing occur
type Pool ¶
type Pool struct { Dial func() (*Client, error) MaxActive int IdleTimeout time.Duration // contains filtered or unexported fields }
Pool maintains a list of connections.
func (*Pool) Execute ¶
Execute grabs a connection from the pool, formats a raw Gremlin query, sends it to Gremlin Server, and returns the result.
func (*Pool) ExecuteWithBindings ¶
func (p *Pool) ExecuteWithBindings(query string, bindings, rebindings map[string]string) (resp []Response, err error)
ExecuteWithBindings formats a raw Gremlin query, sends it to Gremlin Server, and returns the result.
func (*Pool) Get ¶
func (p *Pool) Get() (*PooledConnection, error)
Get will return an available pooled connection. Either an idle connection or by dialing a new one if the pool does not currently have a maximum number of active connections.
type PooledConnection ¶
PooledConnection represents a shared and reusable connection.
func (*PooledConnection) Close ¶
func (pc *PooledConnection) Close()
Close signals that the caller is finished with the connection and should be returned to the pool for future use.
type Response ¶
type Response struct { RequestID string `json:"requestId"` Status Status `json:"status"` Result Result `json:"result"` }
Response structs holds the entire response from requests to the gremlin server
type Result ¶
type Result struct { // Query Response Data Data json.RawMessage `json:"data"` Meta map[string]interface{} `json:"meta"` }
Result struct is used to hold properties returned for results from requests to the gremlin server
type Status ¶
type Status struct { Message string `json:"message"` Code int `json:"code"` Attributes map[string]interface{} `json:"attributes"` }
Status struct is used to hold properties returned from requests to the gremlin server
type Ws ¶
Ws is the dialer for a WebSocket connection
func NewDialer ¶
func NewDialer(host string, configs ...DialerConfig) (dialer *Ws)
NewDialer returns a WebSocket dialer to use when connecting to Gremlin Server
func (*Ws) IsConnected ¶
IsConnected returns whether the underlying websocket is connected
func (*Ws) IsDisposed ¶
IsDisposed returns whether the underlying websocket is disposed