graphql 中的别名对象,

Alias object in graphql,

我知道我的数据是否会像

{
id: 123
address: xyz
name: hello

}

我想在查询期间使用别名我可以这样做

query {
 identification: id
 address 
 full_name : name

}

所以我的数据将如下所示:

{

  identification: 123
  address: xyz
  full_name: hello

}

但我希望即将发布的数据如下所示:

{

  id : 123
  info: {
     address: xyz
     name: hello
   }
  

}

我怎样才能在 GraphQl 查询中实现这一点我怎样才能给别名 info

没有允许您这样做的 GraphQL 语法 client-side。在您的客户端代码中以编程方式应用转换,或者更改服务器上的架构以反映您需要的数据结构。

不,你不能这样做。 GraphQL 别名只能更改字段名称。