Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of uppercase, lowercase, numbers, and special characters (such as @*&#).
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

v4.2
Search
中文EN
v4.2

    Connection | Configs

    UltipaConfig

    UltipaConfig defines the information of server needed when connecting to an Ultipa graph database.

    Item Type Default Value Description
    Hosts []string Ultipa server hosts, separated with comma
    Username string username of server
    Password string password of server
    DefaultGraph string name of graphset to use
    Crt []byte crt file path, provided when establishing ssl connection
    MaxRecvSIze int 10MB max byte when receiving data
    Consistency bool false if use leader host to guarantee Consistency Read
    CurrentGraph string default name of current graphset
    CurrentClusterId string cluster ID of name server
    Timeout uint32 1000 timeout seconds for any request
    Debug bool false if use debug mode
    HeartBeat int 0 heartbeat seconds for all instances, set 0 to turn off heartbeat

    Example: Create a server connection and configure by code

    func TestMisc(t *testing.T) {
    	config := configuration.NewUltipaConfig(&configuration.UltipaConfig{
    		Hosts:    []string{"192.168.1.85:60061", "192.168.1.86:60061", "192.168.1.87:60061"},
    		Username: "***",
    		Password: "***",
    	})
    
    	conn, _ := sdk.NewUltipa(config)
    
    	testResult, _ := conn.Test()
    	println(testResult)
    }
    

    yaml 配置文件

    yaml stores the information of server needed when connecting to an Ultipa graph database.

    Variable in yaml Item in UltipaConfig
    hosts Hosts
    username Username
    password Password
    default_graph DefaultGraph
    crt Crt
    max_recv_size MaxRecvSIze
    consistency Consistency
    current_graph CurrentGraph
    current_cluster_id CurrentClusterId
    timeout Timeout
    debug Debug
    heart_beat HeartBeat

    Example: Create a server connection using configuration file. Place the yaml file 'testConfig.yml' in the path of current Go file

    hosts: 
      - "192.168.1.85:60061"
      - "192.168.1.86:60061"
      - "192.168.1.87:60061"
    username: ***
    password: ***
    default_graph: amz
    timeout:: 300
    

    func TestMisc(t *testing.T) {
    	config, _ := configuration.LoadConfigFromYAML("./testConfig.yml")
    
    	conn, _ := sdk.NewUltipa(config)
    	testResult, _ := conn.Test()
    	println(testResult)
    }
    

    RequestConfig

    RequestConfig defines the information needed when sending non-insert type of requests to an Ultipa graph database.

    Item Type Default Value Description
    GraphName string name of graphset to use, or use DefaultGraph configured when establishing server connection if not set
    Timeout uint32 0 timeout seconds for the request, or use timeout configured when establishing server connection if not set
    ClusterId string cluster ID of name server
    Host string send the request to a designated host, or sent to a random host if not set
    UseMaster bool false if send the request to the leader to guarantee Consistency Read
    UseControl bool false if send the request to control node
    RequestType RequestType or int32 0 send the requset to a node according to the request type:
    RequestType_Write or 1, send to leader
    RequestType_Task or 2, send to algo
    RequestType_Normal or 3, send to a random host
    Uql string UQL for internal program

    Example: Create a server connection using graphset 'default' and send a UQL to write back result to graphset 'amz', send this task to algo

    func TestMisc(t *testing.T) {
    	config := configuration.NewUltipaConfig(&configuration.UltipaConfig{
    		Hosts:    []string{"192.168.1.85:60061", "192.168.1.86:60061", "192.168.1.87:60061"},
    		Username: "***",
    		Password: "***",
    	})
    
    	conn, _ := sdk.NewUltipa(config)
    
    	requestConfig := &configuration.RequestConfig{
    		GraphName:   "amz",
    		RequestType: configuration.RequestType_Task,
        }
    	conn.UQL("algo(degree).params().write({db:{property: \"degree\"}})", requestConfig)
    }
    

    InsertRequestConfig

    InsertRequestConfig defines the information needed when sending insert type of requests to an Ultipa graph database.

    Item Type Default Value Description
    GraphName string name of graphset to use, or use DefaultGraph configured when establishing server connection if not set
    Timeout uint32 0 timeout seconds for the request, or use timeout configured when establishing server connection if not set
    ClusterId string cluster ID of name server
    Host string send the request to a designated host, or sent to a random host if not set
    UseMaster bool false if send the request to the leader to guarantee Consistency Read
    UseControl bool false if send the request to control node
    RequestType RequestType or int32 0 send the requset to a node according to the request type:
    RequestType_Write or 1, send to leader
    RequestType_Task or 2, send to algo
    RequestType_Normal or 3, send to a random host
    Uql string UQL for internal program
    InsertType ultipa.InsertType or int32 0 insert mode:
    InsertType_NORMAL or 0
    InsertType_OVERWRITE or 1
    InsertType_UPSERT or 2
    CreateNodeIfNotExist bool false if create start/end nodes of edge when the end nodes do not exist in the graphset

    Example: Create a server connection using graphset 'default', and insert nodes into graphset 'test' under overwrite mode

    func TestMisc(t *testing.T) {
    	config := configuration.NewUltipaConfig(&configuration.UltipaConfig{
    		Hosts:    []string{"192.168.1.85:60061", "192.168.1.86:60061", "192.168.1.87:60061"},
    		Username: "***",
    		Password: "***",
    	})
    
    	conn, _ := sdk.NewUltipa(config)
    
    	requestConfig := &configuration.RequestConfig{
    		GraphName:   "test",
        }
    	insertRequestConfig := &configuration.InsertRequestConfig{
    		RequestConfig: requestConfig,
    		InsertType:    ultipa.InsertType_OVERWRITE,
    	}  
      
    	var nodes []*structs.Node
    
    	newNode1 := structs.NewNode()
    	newNode1.Schema = "card"
    	newNode1.ID = "ULTIPA8000000000000001"
    	newNode1.Set("amount", float32(3235.2))
    	nodes = append(nodes, newNode1)
    
    	newNode2 := structs.NewNode()
    	newNode2.Schema = "client"
    	newNode2.ID = "ULTIPA8000000000000007"
    	newNode2.Set("level", int32(77))
    	nodes = append(nodes, newNode2)
        
        conn.InsertNodesBatchAuto(nodes, insertRequestConfig)
    }
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写