spark-solutions / chain_it Goto Github PK
View Code? Open in Web Editor NEWRailway Oriented Programming for Ruby
License: MIT License
Railway Oriented Programming for Ruby
License: MIT License
Hey! I spent some time this weekend developing our gem and I came up with an idea. I'd like you to let me know if is this concept, in your eyes, is worth taking care of.
I think about a feature to make possible wrap certain #chain
calls into transactions. For illustration:
Chainer.new.
transaction do
chain { store_pre_tax_amount(order) }.
chain { |order| calculate_tax_from_external_system(order) }.
chain { |order| store_tax(order) }
end.
transaction do |order|
chain { |order| notify_user_about_successful_upload(order.user) }.
chain { |user| update_notified_at(user) }.
end
There might be some situations where Chainer
's "railway-oriented" functionality would be suitable in combination with transactions.
Taking the above example, the system should perform two consequent transactional operations, which every is consisted of more atomic parts. The first is belongs to order tax calculation and save whereas the second is about notifing an user about it. In my implementation Chainer
would process consequent blocks (as usual) as long as they responds to #success
. When the first Activerecord::Transaction
fails - nothing more would be executed.
What are your feelings about that @btolarz?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.