如何解决.where() 带条件逻辑
在 Bookshelf.js 中,如何在 .where() 中实现一些条件逻辑?
其次,如何正确地将查询变量传递给它?
鉴于...
.query('location')
.model.query(qb => {
qb.join('locations','events.Location','locations.id')
.where(
// some logic here,like:
myFunction(
{ latitude: Latitude,longitude: Longitude },{ latitude: ctx.query.Latitude,longitude: ctx.query.Longitude }
) >= 5000
)
})
.fetch();
... 抛出一个错误,如:ReferenceError: Latitude is not defined
。
仅供参考,纬度和经度存在于“位置”中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。