99designs/gqlgen

Can I have a common resolver for multiple interface implementations?

开放

#3,725 创建于 2025年6月6日

 (1 条评论) (1 个反应) (0 位负责人)Go (1,250 个派生)auto 404
help wanted

仓库指标

星标
 (10,737 个星标)
PR 合并指标
 (平均合并 11天) (30 天内合并 20 个 PR)

描述

I have a schema like this:

interface Result {
    title: String!
    description: String! @goField(forceResolver: true)
}

type Book implements Result {
    title: String!
    description: String! @goField(forceResolver: true)
    author: String!
    # ... other fields
}

type Article implements Result {
    title: String!
    description: String! @goField(forceResolver: true)
    section: String!
    # ... other fields
}

When I run the generator, it generates bookResolver and articleResolver, each one with its description field resolver. Is there a way I can generate a common resultResolver for them?

贡献者指南