subgraph

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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

type Client struct {
	sync.RWMutex
	Errored bool
	// contains filtered or unexported fields
}

Client is a container for the gremtune client.

func Dial

func Dial(conn dialer, errsFromCaller chan error) (c Client, err error)

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

func (c *Client) CommitSession(sessionID string) (resp []*Response, err error)

CommitSession formats a raw Gremlin query, closes the session, and then the transaction will be commited

func (*Client) Execute

func (c *Client) Execute(query string) (resp []*Response, err error)

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)

ExecuteAsync formats a raw Gremlin query, sends it to Gremlin Server, and the results are streamed to channel provided in method paramater.

func (*Client) ExecuteFile

func (c *Client) ExecuteFile(path string) (resp []*Response, err error)

ExecuteFile takes a file path to a Gremlin script, sends it to Gremlin Server, and returns the result.

func (*Client) ExecuteFileWithBindings

func (c *Client) ExecuteFileWithBindings(path string, bindings, rebindings map[string]string) (resp []*Response, err error)

ExecuteFileWithBindings takes a file path to a Gremlin script, sends it to Gremlin Server with bindings, and returns the result.

func (*Client) ExecuteWithBindings

func (c *Client) 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 (*Client) ExecuteWithSession

func (c *Client) ExecuteWithSession(query string, sessionID string) (resp []*Response, err error)

ExecuteWithSession formats a raw Gremlin query as part of a session, sends it to Gremlin Server, and returns the result.

func (*Client) ExecuteWithSessionAndTimeout

func (c *Client) ExecuteWithSessionAndTimeout(query string, sessionID string, timeout int) (resp []*Response, err error)

ExecuteWithSession formats a raw Gremlin query as part of a session, 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 SetTimeout

func SetTimeout(seconds int) DialerConfig

SetTimeout sets the dial timeout

func SetWritingWait

func SetWritingWait(seconds int) DialerConfig

SetWritingWait sets the time for waiting that writing occur

type Edge

type Edge struct {
	Type  string    `json:"@type"`
	Value EdgeValue `json:"@value"`
}

Edge represents a vertex returned by the graph database

type EdgeProperty

type EdgeProperty struct {
	Properties map[string]EdgePropertyValue
}

EdgeProperty represents an edge property

type EdgePropertyValue

type EdgePropertyValue struct {
	Type  string            `json:"@type"`
	Value map[string]string `json:"@value"`
}

Group struct

type EdgeValue

type EdgeValue struct {
	ID         string
	Label      string
	InV        string
	OutV       string
	InVLabel   string
	OutVLabel  string
	Properties EdgeProperty
}

EdgeValue represents a vertex value

type NeptuneSubGraph

type NeptuneSubGraph struct {
	Value []struct {
		Value struct {
			Vertices []Vertex `json:"vertices,omitempty"`
			Edges    []Edge   `json:"edges,omitempty"`
		} `json:"@value,omitempty"`
	} `json:"@value,omitempty"`
}

NeptuneSubGraph having the subgraph response from neptune

func (*NeptuneSubGraph) CountEdges

func (subgraph *NeptuneSubGraph) CountEdges() int

CountEdges returns the number of Edges in the SubGraph

func (*NeptuneSubGraph) CountVertices

func (subgraph *NeptuneSubGraph) CountVertices() int64

CountVertices returns the number of Edges in the SubGraph

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

func (Response) ToString

func (r Response) ToString() string

ToString returns a string representation of the Response struct

type Result

type Result struct {
	// Query Response Data
	Data NeptuneSubGraph        `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 Vertex

type Vertex struct {
	Type  string      `json:"@type"`
	Value VertexValue `json:"@value"`
}

Vertex represents a vertex returned by the graph database

type VertexProperty

type VertexProperty struct {
	Value VertexPropertyValue `json:"@value"`
}

VertexProperty represents a vertex property

type VertexPropertyValue

type VertexPropertyValue struct {
	Value interface{} `json:"value"`
}

VertexPropertyValue represents a property value

type VertexValue

type VertexValue struct {
	ID         string
	Label      string
	Properties map[string][]VertexProperty
}

VertexValue represents a vertex value

type Ws

type Ws struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

func (ws *Ws) IsConnected() bool

IsConnected returns whether the underlying websocket is connected

func (*Ws) IsDisposed

func (ws *Ws) IsDisposed() bool

IsDisposed returns whether the underlying websocket is disposed

Jump to

Keyboard shortcuts

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