修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

搜索
    中文

      使用 UQL

      UQL()

      方法及相关类:

      UQL(uql string, config *configuration.RequestConfig) (*http.UQLResponse, error)
      

      使用 UQL() 进行请求时会返回结果类 UQLResponse。

      UQLResponse 的字段:

      字段 类型 说明
      AliasList []string return 返回的数据的别名
      DataItemMap Map[string]struct return 返回的数据,每个别名对应的 *DataItem
      ExplainPlan *ExplainPlan UQL 语句解析树
      Status *Status Ultipa Server 返回的执行状态
      Statistic *Statistic 执行的统计信息,包含执行时间、影响点边数等
      Reply *ultipa.UqlReply UQL 请求的所有结果
      Resp ultipa.UltipaRpcs_UqlClient GRPC stream

      UQLResponse 的方法:

      方法 类型 说明
      Get(index int) *DataItem 按下标获取查询结果中的某一个返回值并返回其指针(*DataItem)
      Alias(alias string) *DataItem 按别名获取查询结果中的某一个返回值并返回其指针(*DataItem)
      GetSingleTable() *structs.Table 将查询结果中的第一个返回值(必须为 TABLE 类型)转为 Table 并返回其指针(*structs.Table)

      返回值的别名类型有 NODE、EDGE、PATH 等,使用 DataItem 类的相应的方法可以将这些类型转为相应的类,详见下一章《返回值的结构化》。

      Get()

      示例:发送语句 return now() as currentTime, pi() as PI,按下标取出第一个返回值,转为 Attr 并输出

      func TestMisc(t *testing.T) {
          // 创建名为 conn 的连接,此部分代码省略
        
      	resp, _ := conn.UQL("return now() as currentTime, pi() as PI", nil)
      	attr, _ := resp.Get(0).AsAttr()
      	printers.PrintAttr(attr)
      }
      

      输出:

      +-------------------------+
      | currentTime             |
      +-------------------------+
      | 2022-12-17 07:17:39.886 |
      +-------------------------+
      

      Alias()

      示例:发送语句 return now() as currentTime, pi() as PI,按别名取出第二个返回值,转为 Attr 并输出

      func TestMisc(t *testing.T) {
          // 创建名为 conn 的连接,此部分代码省略
        
      	resp, _ := conn.UQL("return now() as currentTime, pi() as PI", nil)
      	attr, _ := resp.Alias("PI").AsAttr()
      	printers.PrintAttr(attr)
      }
      

      输出:

      +------------------+
      | PI               |
      +------------------+
      | 3.14159265358979 |
      +------------------+
      

      GetSingleTable()

      示例:发送语句 uncollect [1,2,3] as number uncollect ["a", "b", "c"] as letter return table(number, letter),取出返回的表格

      func TestMisc(t *testing.T) {
          // 创建名为 conn 的连接,此部分代码省略
        
      	resp, _ := conn.UQL("uncollect [1,2,3] as number uncollect [\"a\", \"b\", \"c\"] as letter return table(number, letter)", nil)
      	table, _ := resp.GetSingleTable()
      	printers.PrintTable(table)
      }
      

      输出:

      +--------+--------+
      | number | letter |
      +--------+--------+
      |   1    |   a    |
      |   2    |   b    |
      |   3    |   c    |
      +--------+--------+
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写