现有类的typeGraphQL解析器
如何为我无法编辑的类typegraphql编写解析器?
通常,我会有这样的情况:
@ObjectType()
export class User {
@Field()
f_name!: string;
@Field()
l_name!: string;
@Field()
email!: string;
}
我可以添加一个返回该类的解析器,
@Query(() => User)
user():Promise<User>{
some code which returns a User
}
现在我使用的是一个软件包来定义类trassactionOutput
,并且我想将此对象用作我的GraphQl查询的返回。在不编辑该课程的情况下,我该如何完成此操作?
How can I write a resolver in typegraphql for a class I can not edit myself?
Normally I would have the situation that I write a class e.g.
@ObjectType()
export class User {
@Field()
f_name!: string;
@Field()
l_name!: string;
@Field()
email!: string;
}
And then I can add a resolver which returns this class
@Query(() => User)
user():Promise<User>{
some code which returns a User
}
Now I am using a package which defines a class transactionOutput
and I would like to use this object as a return for my graphql query. How can I accomplish this without editing that class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论