使用 GqlGen 生成代码后,已经创建了一些字段解析器方法。我需要访问字段解析器中的查询输入参数,但我不确定如何访问它。我需要从上下文中获取这些值吗?或者还有其他办法吗?
查询解析器:
func (r *queryResolver) Main(ctx context.Context, device string) (*models.Main, error) {
...
}
字段解析器:
// Version is the resolver for the version field.
func (r *mainResolver) Version(ctx context.Context, obj *models.Main) (*models.Version, error) {
// I NEED TO ACCESS device param here which is passed in Main method
panic(fmt.Errorf("not implemented: Version - version"))
}
谢谢,
斯蒂芬大帝
相关分类