GetProperty()
Method and class:
GetProperty(schemaName string,
propertyName string,
dbType ultipa.DBType,
config *configuration.RequestConfig
) (property *structs.Property, err error)
Example: Acquire node property @client.level
and edge property @transfer.amount
of graphset 'test'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn' using graphset 'default'
requestConfig := &configuration.RequestConfig{
GraphName: "test",
}
nodeProp, _ := conn.GetProperty("client", "level", ultipa.DBType_DBNODE, requestConfig)
fmt.Println(nodeProp)
edgeProp, _ := conn.GetProperty("transfer", "amount", ultipa.DBType_DBEDGE, requestConfig)
fmt.Println(edgeProp)
GetNodeProperty() | GetEdgeProperty()
Method and class:
GetNodeProperty(schemaName string,
propertyName string,
config *configuration.RequestConfig
) (property *structs.Property, err error)
GetEdgeProperty(schemaName string,
propertyName string,
config *configuration.RequestConfig
) (property *structs.Property, err error)
Example: Acquire node property @client.level
and edge property @transfer.amount
of graphset 'test'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn' using graphset 'default'
requestConfig := &configuration.RequestConfig{
GraphName: "test",
}
nodeProp, _ := conn.GetNodeProperty("client", "level", requestConfig)
fmt.Println(nodeProp)
edgeProp, _ := conn.GetEdgeProperty("transfer", "amount", requestConfig)
fmt.Println(edgeProp)
CreateProperty()
Method and class:
CreateProperty(schemaName string,
dbType ultipa.DBType,
prop *structs.Property,
conf *configuration.RequestConfig
) (resp *http.UQLResponse, err error)
Property struct {
Name string
Desc string
Lte bool
Schema string
Type ultipa.PropertyType
}
Example: Craete edge property @transfer.amount
for graphset 'test', with data type 'float' and description 'transaction amount'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn' using graphset 'default'
requestConfig := &configuration.RequestConfig{
GraphName: "test",
}
property := &structs.Property{
Name: "amount",
Desc: "transaction amount",
Type: ultipa.PropertyType_FLOAT,
}
resp, _ := conn.CreateProperty("transfer", ultipa.DBType_DBEDGE, property, requestConfig)
log.Println(resp)
}
CreateNodeProperty() | CreateEdgeProperty()
Method and class:
CreateNodeProperty(schemaName string,
prop *structs.Property,
conf *configuration.RequestConfig
) (resp *http.UQLResponse, err error)
CreateEdgeProperty(schemaName string,
prop *structs.Property,
conf *configuration.RequestConfig
) (resp *http.UQLResponse, err error)
Property struct {
Name string
Desc string
Lte bool
Schema string
Type ultipa.PropertyType
}
Example: Craete edge property @transfer.amount
for graphset 'test', with data type 'float' and description 'transaction amount'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn' using graphset 'default'
requestConfig := &configuration.RequestConfig{
GraphName: "test",
}
property := &structs.Property{
Name: "amount",
Desc: "transaction amount",
Type: ultipa.PropertyType_FLOAT,
}
resp, _ := conn.CreateEdgeProperty("transfer", property, requestConfig)
log.Println(resp)
}
CreatePropertyIfNotExist()
Method and class:
CreatePropertyIfNotExist(schemaName string,
dbType ultipa.DBType,
prop *structs.Property,
config *configuration.RequestConfig
) (exist bool, err error)
Property struct {
Name string
Desc string
Lte bool
Schema string
Type ultipa.PropertyType
}
Example: Return 'true' if property already exists, or return 'false' and create property if not
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn' using graphset 'default'
requestConfig := &configuration.RequestConfig{
GraphName: "test",
}
property := &structs.Property{
Name: "amount",
Desc: "transaction amount",
Type: ultipa.PropertyType_FLOAT,
}
isExist, _ := conn.CreatePropertyIfNotExist("transfer", ultipa.DBType_DBEDGE, property, requestConfig)
log.Println(isExist)
}
AlterNodeProperty() | AlterEdgeProperty()
Method and class:
AlterNodeProperty(propertyName string,
prop *structs.Property,
config *configuration.RequestConfig
) (resp *http.UQLResponse, err error)
AlterEdgeProperty(propertyName string,
prop *structs.Property,
config *configuration.RequestConfig
) (resp *http.UQLResponse, err error)
Property struct {
Name string
Desc string
Lte bool
Schema string
Type ultipa.PropertyType
}
Example: Modify node property @client.level
and edge property @transfer.type
of graphset 'test'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn' using graphset 'default'
requestConfig := &configuration.RequestConfig{
GraphName: "test",
}
nodeProp := &structs.Property{
Name: "grade",
Desc: "client grade",
}
resp1, _ := conn.AlterNodeProperty("@client.level", nodeProp, requestConfig)
log.Println(resp1)
edgeProp := &structs.Property{
Name: "category",
Desc: "transfer category",
}
resp2, _ := conn.AlterEdgeProperty("@transfer.type", edgeProp, requestConfig)
log.Println(resp2)
}
DropNodeProperty() | DropEdgeProperty()
Method and class:
DropNodeProperty(propertyName string, config *configuration.RequestConfig) (resp *http.UQLResponse, err error)
DropEdgeProperty(propertyName string, config *configuration.RequestConfig) (resp *http.UQLResponse, err error)
Example: Delete node property @card.level
and edge property @transfer.category
of graphset 'test'
func TestMisc(t *testing.T) {
// omit code of establishing server connection 'conn' using graphset 'default'
requestConfig := &configuration.RequestConfig{
GraphName: "test",
}
resp1, _ := conn.DropNodeProperty("@client.grade", requestConfig)
log.Println(resp1)
resp2, _ := conn.DropEdgeProperty("@transfer.category", requestConfig)
log.Println(resp2)
}