Code Explainers
Code explainers tagged #transactions
java
@Entity @Table(name = "accounts") public class Account {
Optimistic locking with @Version in Spring
optimistic-locking
jpa
concurrency
Advanced
7 steps
ruby
class PaymentsController < ApplicationController before_action :require_idempotency_key def create
Idempotent payment creation in Rails
idempotency
transactions
race-conditions
Advanced
10 steps
java
@Repository public interface OrderRepository extends JpaRepository<Order, Long> { @QueryHints(@QueryHint(name = HINT_FETCH_SIZE, value = "1000"))
Streaming large result sets in Spring Data JPA
streaming
jpa
memory-management
Advanced
6 steps
ruby
class CheckoutService Result = Struct.new(:success?, :order, :error, keyword_init: true) def self.call(...)
How a Rails checkout service object works
service object
transactions
result object
Intermediate
9 steps
ruby
class RegistrationForm include ActiveModel::Model include ActiveModel::Attributes
How a Rails form object spans two models
form object
validations
transactions
Intermediate
7 steps
ruby
module FileResource # Opens a file, yields it to the caller, and guarantees the # handle is closed even if the block raises an exception. def self.open(path, mode = "r")
Guaranteeing cleanup with begin/ensure in Ruby
resource-management
exception-safety
blocks
Intermediate
8 steps