Is there any way do define in model custom attribute which should be added on every select? I need to add custom sql in select as field.
let distance = sequelize.literal("(6371 * ACOS(COS(RADIANS(:latitude)) * COS(RADIANS(`Latitude`)) * COS(RADIANS(`Longitude`) - RADIANS(:longitude)) + SIN(RADIANS(:latitude)) * SIN(RADIANS(`Latitude`)))) AS 'Distance'")
I need that Distance would be in every select I do for the model.
via Kin
No comments:
Post a Comment