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

    Schema

    ListSchema()

    Method and class:

    ListSchema(DBType ultipa.DBType, config *configuration.RequestConfig) ([]*structs.Schema, error)
    

    Example: Acquire all schemas of graphset 'test'

    func TestMisc(t *testing.T) {
        // omit code of establishing server connection 'conn' using graphset 'default'
    
      	requestConfig := &configuration.RequestConfig{
    		GraphName: "test",
    	}
      
    	nodeSchemas, _ := conn.ListSchema(ultipa.DBType_DBNODE, requestConfig)
    	printers.PrintSchema(nodeSchemas)
    	edgeSchemas, _ := conn.ListSchema(ultipa.DBType_DBEDGE, requestConfig)
    	printers.PrintSchema(edgeSchemas)
    }
    

    GetSchema()

    Method and class:

    GetSchema(schemaName string, 
    		  DBType ultipa.DBType, 
              config *configuration.RequestConfig
    ) (*structs.Schema, error)
    

    Example: Acquire node schema 'account' and edge schema 'transfer' of graphset 'test'

    func TestMisc(t *testing.T) {
        // omit code of establishing server connection 'conn' using graphset 'default'
    
      	requestConfig := &configuration.RequestConfig{
    		GraphName: "test",
    	}
      
    	nodeSchema, _ := conn.GetSchema("client", ultipa.DBType_DBNODE, requestConfig)
    	fmt.Println(*nodeSchema)
    	edgeSchema, _ := conn.GetSchema("transfer", ultipa.DBType_DBEDGE, requestConfig)
    	fmt.Println(*edgeSchema)
    }
    

    GetNodeSchema() | GetEdgeSchema()

    Method and class:

    GetNodeSchema(schemaName string, config *configuration.RequestConfig) (*structs.Schema, error)
    
    GetEdgeSchema(schemaName string, config *configuration.RequestConfig) (*structs.Schema, error)
    

    Example: Acquire node schema 'account' and edge schema 'transfer' of graphset 'test'

    func TestMisc(t *testing.T) {
        // omit code of establishing server connection 'conn' using graphset 'default'
    
      	requestConfig := &configuration.RequestConfig{
    		GraphName: "test",
    	}
      
    	nodeSchema, _ := conn.GetNodeSchema("client", requestConfig)
    	fmt.Println(*nodeSchema)
    	edgeSchema, _ := conn.GetEdgeSchema("transfer", requestConfig)
    	fmt.Println(*edgeSchema)
    }
    

    CreateSchema()

    Method and class:

    CreateSchema(schema *structs.Schema, 
    			 isCreateProperties bool, 
                 conf *configuration.RequestConfig
    ) (*http.UQLResponse, error)
    
    Schema struct {
    	Name       string
    	Properties []*Property
    	Desc       string
    	Type       string
    	DBType     ultipa.DBType
    	Total      int
    }
    
    Property struct {
    	Name   string
    	Desc   string
    	Lte    bool
    	Schema string
    	Type   ultipa.PropertyType
    }
    

    Example: Create node schema 'card1' with properties and 'card2' without property for graphset 'test'

    func TestMisc(t *testing.T) {
        // omit code of establishing server connection 'conn' using graphset 'default'
    
      	requestConfig := &configuration.RequestConfig{
    		GraphName: "test",
    	}
      
    	schema := &structs.Schema{
    		Name:   "card1",
    		Desc:   "card with 2 properties",
    		DBType: ultipa.DBType_DBNODE,
    		Properties: []*structs.Property{
    			{
    				Name: "balance",
    				Type: ultipa.PropertyType_FLOAT,
    			},
    			{
    				Name: "level",
    				Type: ultipa.PropertyType_INT32,
    			},
    		},
    	}
    
    	resp1, _ := conn.CreateSchema(schema, true, requestConfig)
    	log.Println(resp1.Status.Code)
    
    	schema.Name = "card2"
    	schema.Desc = "card with no property"
    
    	resp2, _ := conn.CreateSchema(schema, false, requestConfig) // 2nd parameter 'false' means do not create property
    	log.Println(resp2.Status.Code)
    }
    

    CreateSchemaIfNotExist()

    Method and class:

    CreateSchemaIfNotExist(schema *structs.Schema, config *configuration.RequestConfig) (exist bool, err error)
    
    Schema struct {
    	Name       string
    	Properties []*Property
    	Desc       string
    	Type       string
    	DBType     ultipa.DBType
    	Total      int
    }
    
    Property struct {
    	Name   string
    	Desc   string
    	Lte    bool
    	Schema string
    	Type   ultipa.PropertyType
    }
    

    Example: Return 'true' if schema already exists, or return 'fasle' and create schema if not

    func TestMisc(t *testing.T) {
        // omit code of establishing server connection 'conn' using graphset 'default'
    
      	requestConfig := &configuration.RequestConfig{
    		GraphName: "test",
    	}
      
    	schema := &structs.Schema{
    		Name: "card1",
            DBType: ultipa.DBType_DBNODE,
    	}
    
    	isExist, _ := conn.CreateSchemaIfNotExist(schema, requestConfig)
    	log.Println(isExist)    
    }
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写