how to implement retrieval of DB records by two params?
hey guys. i want to ask you for advice. so im coding an api which takes two params (season of the year, distance of the hike) and returns a list of items that i should put in my backpack. in DB i have one table
Items
with three columns id
, name
, season
, distance
. but i was wondering how to incorporate these two criterias in my code. like how to approach it? i have this service now:
and idk how to add get by distance
functionality. i dont want to have two separate methods (one for retrieving items by season, and one for filtering those records by distance). I can have just one method (obviously). but idk if having public List<Item> getItemsBySeasonAndDistance(String season, double distance)
method makes sense. what do u guys think? thanks3 Replies
⌛
This post has been reserved for your question.
Hey @bambyzas! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
..... Obviously it makes sense, since this is the sort of stuff the api users may want to query
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.