dry-rb / dry-transaction

Business transaction DSL
http://dry-rb.org/gems/dry-transaction
MIT License
469 stars 55 forks source link

Best way to pass new parameters to the next step #116

Closed cmavromoustakos closed 5 years ago

cmavromoustakos commented 5 years ago

I have a scenario where a transaction calls another transaction (which I am reusing elsewhere) and adds a parameter from the result of that transaction to the call to the next step. The code is as follows:

 ┆ def validate_attributes(gig:, indie:)
 ┆ ┆ Operations::ValidateGig.new.call(gig: gig).bind do |result_value|
       gig = result_value.fetch(:gig)
 ┆ ┆ ┆ Success(gig: gig, indie: indie)
 ┆ ┆ end
 ┆ end

Is there a more elegant way that is recommended to accomplish the above? My worry is that I am using the library in a way that is not documented and this could possibly break in future versions.

timriley commented 5 years ago

Hi Constantine, could you please move this question to http://discourse.dry-rb.org? We don’t use Github issues for support questions.

Appreciate it!

Tim

On 12 Jan 2019, at 9:13 am, Constantine Mavromoustakos notifications@github.com wrote:

I have a scenario where a transaction calls another transaction (which I am reusing elsewhere) and adds a parameter from the result of that transaction to the call to the next step. The code is as follows:

┆ def validate_attributes(gig:, indie:) ┆ ┆ Operations::ValidateGig.new.call(gig: gig).bind do |result_value| gig = result_value.fetch(:gig) ┆ ┆ ┆ Success(gig: gig, indie: indie) ┆ ┆ end ┆ end Is there a more elegant way that is recommended to accomplish the above? My worry is that I am using the library in a way that is not documented and this could possibly break in future versions.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.