Hello,
I am planning to use some of spatial functions in postgresql and was thinking to use the following package https://www.npmjs.com/package/knex-postgis
. I guess the best way to approach is to define a new plugin with geometry column type and handle queries using the plugin environment. But since I just want to work with point data and only store them and query based on the distance I decided to go with Hooks system.
So here is my question. Looking at hook system it seems it is straight forward that I need to use beforeCreate
and beforeUpdate
to save data as point geometry. To query them I have to use beforeFind
event. However I am not sure If I have access to Knex
object in the hooks. Is there any way to modify queries inside the Hooks?