dwyl / phoenix-uk-postcode-finder-example

📍An example/tutorial application showing how to rapidly find your nearest X by typing your postcode.
GNU General Public License v2.0
8 stars 2 forks source link

Thoughts on how the store finder could work #5

Open RobStallion opened 5 years ago

RobStallion commented 5 years ago

I have been thinking about possible ways of we could implement a "nearest store" feature for this example.

We could use a similar approach to the one we took in Club Soda, where we get postgres to do the logic for us. This approach worked well.

However I was hoping to make use of ets (erlang term storage) tables in this example, something the above does not do. Dictionary With this in mind I was trying to come up with an approach that didn't rely on a database at all.

I would like to store all of our "stores" (outdoor gyms / vegan restaurants / etc) in our ets table and query that table directly to get the nearest stores. In order to run a complex query on an ets table it looks like we need to use a guard clause. The means that we will need to define our own macro that can be used in a guard clause. See #3 for more info on this. This is proving to be quite challenging.

I would like to know what people this is a good approach this solving this. If anyone has any thoughts/idea/suggestions/comments then please respond.