当客户端发送请求时,我想知道客户端请求数据的字段是什么。例如,
Sub InsertRev()
Dim c As Range
Set Rng = ActiveSheet.Range("d1:d5000")
For dblCounter = Rng.Cells.Count To 1 Step -1
Set c = Rng(dblCounter)
If c.Value Like "*TOTAL*" Then
c.EntireRow.Insert xlShiftDown, xlFormatFromLeftOrAbove
End If
Next dblCounter
End Sub
在上述请求中,客户端已请求用户的myApp.controller('SpicyController', ['$scope', '$http', 'userService', , function
字段和{
user {
name
address
}
}
字段。如何在执行查询时知道/获取这些指定的字段,即sangria-graphql Server中的名称和地址?
答案 0 :(得分:2)
您必须在4th
resolve()
参数
resolve: (obj, args, auth, fieldASTs) => {
/* all your fields are present in selections
please check the fieldASTs JSON path it may vary if you are using relay
connections */
const requiredFields = fieldASTs.fieldNodes[0].selectionSet.selections.map(
(set) => set.name.value
);
// requiredFields will contain the name and address
}
/* fieldASTs contains fieldNames, fieldNodes and every details about your Schema
you can get your specified fields inside fieldNodes like */