2

我可以在同一个突变上插入多个吗?

我想知道这是否存在。

这是我的架构

type Test {
    id: ID
    name: String
    msg: String
}

input testInput {
    name: String
    msg: String
}

type Mutation {
    createTest(input: [testInput]): [Test] @create
}

这是我的突变查询

mutation{
    createTest(input: [
        {id:1,  name: "test", msg:"hahaha",},
        {id:2, name: "test2", msg:"hahahaa" }
    ]) {
        id
        name
        msg
    }
}
4

1 回答 1

2

您可以使用自定义突变:

php artisan lighthouse:mutation CreateTest

如果你想要一些可重用的东西,你可能想要实现一个自定义字段解析器指令。@create研究如何实现的想法。

于 2019-12-05T10:21:01.133 回答