如何在 JavaScript 中动态设置 Neo4j Graphql 的 SortDirection?
我正在使用 neo4j 的 graphql 库,它使用枚举作为 SortDirections,如下所示:
enum SortDirection {
ASC
DESC
}
我希望能够从我的 React Native 应用程序中动态设置它,但我不确定如何处理它,因为我可以'不只是参考DESC
- 我想出的最接近的方法是将其设为字符串,这不起作用“DESC”
。
let options = { sort: { originalValue: sortDirection }, limit: 10 }
由于它是枚举而不是字符串,因此 "DESC"
不起作用。但我不能只写 DESC
因为它不是我的 javascript 应用程序中定义的变量,知道该怎么做吗?先感谢您。
I'm using neo4j's graphql library and it uses enums for SortDirections, like this:
enum SortDirection {
ASC
DESC
}
And I would like to be able to dynamically set this from my React Native application, but I'm not sure how I would go about it because I can't just reference DESC
- the closest I have come up with is making it a string, which doesn't work "DESC"
.
let options = { sort: { originalValue: sortDirection }, limit: 10 }
Since it's an enum and not a string, "DESC"
doesn't work. But I'm not able to just write DESC
because it's not a defined variable in my javascript application, any idea what to do? Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,这是一个愚蠢的错误。字符串
"DESC"
似乎确实有效!Sorry, this was a silly mistake. The String
"DESC"
does seem to work!