Facebook
From Scribby Motmot, 5 Years ago, written in Plain Text.
This paste is a reply to Untitled from Gentle Peccary - view diff
Embed
Download Paste or View Raw
Hits: 206
  1. func (s *Service) DoSomething(name string) error {
  2.     return s.transaction(func(tx Interface) error {
  3.  
  4.     })
  5. }
  6.  
  7. func (s *Service) transaction(fn func(tx Interface) error) error {
  8.     return s.d.Transaction(func(tx *db.ClusterTx) error {
  9.         return fn(tx)
  10.     })
  11. }