Documentation ¶
Index ¶
- Constants
- Variables
- func CreateConnection() (conn net.Conn, server *url.URL, err error)
- func GraphSONSerializer(req *Request) ([]byte, error)
- func NewCluster(s ...string) (err error)
- func SplitServers(connString string) (servers []*url.URL, err error)
- type AuthInfo
- type Bind
- type Client
- type FormattedReq
- type OptAuth
- type Request
- type RequestArgs
- type Response
- type ResponseResult
- type ResponseStatus
Constants ¶
View Source
const ( StatusSuccess = 200 StatusNoContent = 204 StatusPartialContent = 206 StatusAuthenticate = 407 StatusMalformedRequest = 498 StatusInvalidRequestArguments = 499 StatusServerError = 500 StatusScriptEvaluationError = 597 StatusServerTimeout = 598 StatusServerSerializationError = 599 )
Variables ¶
View Source
var ErrorMsg = map[int]string{ StatusUnauthorized: "Unauthorized", StatusAuthenticate: "Authenticate", StatusMalformedRequest: "Malformed Request", StatusInvalidRequestArguments: "Invalid Request Arguments", StatusServerError: "Server Error", StatusScriptEvaluationError: "Script Evaluation Error", StatusServerTimeout: "Server Timeout", StatusServerSerializationError: "Server Serialization Error", }
Functions ¶
func GraphSONSerializer ¶
func NewCluster ¶
Types ¶
type AuthInfo ¶
AuthInfo includes all info related with SASL authentication with the Gremlin server ChallengeId is the requestID in the 407 status (AUTHENTICATE) response given by the server. We have to send an authentication request with that same RequestID in order to solve the challenge.
func NewAuthInfo ¶
Constructor for different authentication possibilities
type Client ¶
Clients include the necessary info to connect to the server and the underlying socket
func (*Client) Authenticate ¶
Authenticates the connection
func (*Client) ReadResponse ¶
type FormattedReq ¶
type FormattedReq struct { Op string `json:"op"` RequestId interface{} `json:"requestId"` Args *RequestArgs `json:"args"` Processor string `json:"processor"` }
Formats the requests in the appropriate way
func NewFormattedReq ¶
func NewFormattedReq(req *Request) FormattedReq
type OptAuth ¶
func OptAuthEnv ¶
func OptAuthEnv() OptAuth
Sets authentication info from environment variables GREMLIN_USER and GREMLIN_PASS
func OptAuthUserPass ¶
Sets authentication information from username and password
type Request ¶
type Request struct { RequestId string `json:"requestId"` Op string `json:"op"` Processor string `json:"processor"` Args *RequestArgs `json:"args"` }
func (*Request) ManageTransaction ¶
func (*Request) SetProcessor ¶
type RequestArgs ¶
type RequestArgs struct { Gremlin string `json:"gremlin,omitempty"` Session string `json:"session,omitempty"` Bindings Bind `json:"bindings,omitempty"` Language string `json:"language,omitempty"` Rebindings Bind `json:"rebindings,omitempty"` Sasl string `json:"sasl,omitempty"` BatchSize int `json:"batchSize,omitempty"` ManageTransaction bool `json:"manageTransaction,omitempty"` Aliases map[string]string `json:"aliases,omitempty"` }
type Response ¶
type Response struct { RequestId string `json:"requestId"` Status *ResponseStatus `json:"status"` Result *ResponseResult `json:"result"` }
type ResponseResult ¶
type ResponseResult struct { Data json.RawMessage `json:"data"` Meta map[string]interface{} `json:"meta"` }
type ResponseStatus ¶
Click to show internal directories.
Click to hide internal directories.