问题描述
在 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 (将#修改为@)