apex-enterprise-patterns / fflib-apex-common

Common Apex Library supporting Apex Enterprise Patterns and much more!
BSD 3-Clause "New" or "Revised" License
899 stars 514 forks source link

Add queryWithBinds to Selector layer #476

Closed MayTheSForceBeWithYou closed 6 months ago

MayTheSForceBeWithYou commented 6 months ago

In Winter '24 release, Salesforce introduced the ability to make SOQL queries with bound parameters: Dynamically Pass Bind Variables to a SOQL Query. Add this functionality to the fflib Selector layer.

Describe the solution you'd like // TODO: A clear and concise description of what you want to happen.

Describe alternatives you've considered // TODO: A clear and concise description of any alternative solutions or features you've considered.

Additional context // TODO: Add any other context or screenshots about the feature request here.

wimvelzeboer commented 6 months ago

It might be a way to make real unit-test (with mocking) for selector classes. Now we can't really make those tests without going to the database.

daveespo commented 6 months ago

@MayTheSForceBeWithYou -- Hi Nathan -- hope all is well

Can you elaborate a bit more with a couple of example use cases? i.e. pseudocode for how you'd like a feature like this to work?

fflib_SObjectSelector does not actually "run the query" (disregarding the two special case selectSObjectsById and queryLocatorById default 'finder' methods) -- it's up to the author of the Selector class to do Database.query .. and that same author could use Database.queryWithBinds today without any further enhancements to fflib_SObjectSelector