func (s *Service) DoSomething(name string) error { s.d.Transaction(func(tx Interface) error { }) } func (s *Service) transaction(fn func(tx Interface) error) error { return s.d.Transaction(func(tx *db.ClusterTx) error { return fn(tx) }) }