From ed4a96ce3b1dda4d5c8238350bacb83577b284b5 Mon Sep 17 00:00:00 2001 From: Fernando Correa de Oliveira Date: Wed, 25 Sep 2019 00:35:12 +0100 Subject: [PATCH] Add database name to event. Related to #400 --- lib/Red/Do.pm6 | 1 + lib/Red/Driver.pm6 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Red/Do.pm6 b/lib/Red/Do.pm6 index e1d1f7d7..5419621c 100644 --- a/lib/Red/Do.pm6 +++ b/lib/Red/Do.pm6 @@ -103,6 +103,7 @@ proto red-do(|) { multi red-do(*@blocks where .all ~~ Callable, Str :$with = "default", :$async) is export { X::Red::Do::DriverNotDefined.new(:driver($with)).throw unless %GLOBAL::RED-DEFULT-DRIVERS{$with}:exists; my @ret = do for @blocks { + my Str $*RED-DO-WITH = $with; red-do :with(%GLOBAL::RED-DEFULT-DRIVERS{$with}), $_, :$async } if $async { diff --git a/lib/Red/Driver.pm6 b/lib/Red/Driver.pm6 index 651991a8..ffc65950 100644 --- a/lib/Red/Driver.pm6 +++ b/lib/Red/Driver.pm6 @@ -22,7 +22,7 @@ multi method emit($data) { } multi method emit(Red::Event $event) { - $!supplier.emit: $event.clone: :db(self), :db-name(self.^name) + $!supplier.emit: $event.clone: :db(self), :db-name(self.^name), |(:db-name($_) with $*RED-DO-WITH) } method schema-reader(--> Red::SchemaReader) { ... }