Connection Configuration
The Configuration for connection and request to ultipa graph
Key | Type | Description |
---|---|---|
Hosts | []string | Ultipa Graph Hosts List |
Username | string | the username string |
Password | string | password of username |
DefaultGraph | string | the graph to use when connection is established |
MaxRecvSIze | int | max byte when receive data |
Consistency | bool | if use Consistency Read |
CurrentGraph | string | the graph to use in run-time |
Timeout | uint32 | the timeout seconds for any request |
Debug | bool | if open debug mode |
HeartBeat | int | the seconds of heartbeat to all instances, 0 means turn off heartbeat |
Create Ultipa Client by Configuration
// Create a Connection Configuration
config := configuration.NewUltipaConfig(&configuration.UltipaConfig{
Hosts: []string{"10.0.0.1:60061", "10.0.0.2:60061", "10.0.0.3:60061"},
Username: "root",
Password: "root",
})
// Get Ultipa Client Instance
client, err := sdk.NewUltipa(config)
Request Configuration
User can change request configuration in any request api
Key | Type | Description |
---|---|---|
GraphName | string | change CurrentGraph |
Timeout | uint32 | timeout seconds |
Host | string | use special host as request target |
UseMaster | bool | consistency read, force to use leader |
InsertType | ultipa.InsertType | InsertType_NORMAL, InsertType_OVERWRITE, InsertType_UPSERT |
CreateNodeIfNotExist | bool | used for insert edges |
// Use default configuration as request configuration and send uql request
resp, _ := client.UQL("find().nodes() as nodes return nodes limit 10", nil)
// Change Timeout to 20 seconds and send uql request
rConfig := &configuration.RequestConfig{
Timeout: 20,
}
resp2, _ := client.UQL("find().nodes() as nodes return nodes limit 10", rConfig)