title: What are the responsibilities of the data layer?
body: <p>I'm working on a project where I had to add a data layer to my application. I've always thought that the data layer is purely responsible for CRUD functions ie. shouldn't really contain any logic but should simply retrieve data for the business layer to manipulate.</p>
  
  <p>However I'm a little confused with my project because I'm not sure whether I've structured my app correctly for this scenario.</p>
  
  <p>Basically I'm trying to retrieve a list of products from the database that fall within a certain pricing threshold. At the moment I have a function in my data layer that basically returns all products where price > min threshold and price &lt; max threshold. But it got me thinking that maybe this is incorrect. Should the data layer simply return a list of ALL products and then the business logic do the filtering?</p>
  
  <p>I'm pretty confused over whether the data layer should simply provide methods that allow the business layer to get raw data or whether it should be responsible for getting filtered data too?</p>
  
  <p>If anyone has an article or something explaining this in detail it'd be very helpful.</p>
  
  <p>Thanks</p>