且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

传递变量以使用复杂的输入类型进行查询

更新时间:2023-09-27 09:30:31

通常,为 [API, BE] 突变规范中定义的任何复杂输入类型准备 [并作为变量传递] 对象.

variables: {
    paymentIntentId: paymentIntentId, 
    pairIntentId: setupIntentId,
    orderInput: { date: orderInput.date,
    ...

... 或者在这种情况下(orderInput 之前定义)只是

... or in this case (orderInput defined earlier) simply

orderInput: orderInput

...或者当然(如果名称匹配)只是:

... or of course (if name matches) just:

variables: {
    paymentIntentId: paymentIntentId, 
    pairIntentId: setupIntentId,
    orderInput,
    ...

简单地在查询/变异中:

In query/mutation simply:

$orderInput: OrderInputData

关注

orderInput: $orderInput`