From a256048496724518ba979d38e7f4c893216bf45e Mon Sep 17 00:00:00 2001 From: Sydonian <794346190@qq.com> Date: Wed, 6 Sep 2023 10:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96TypeUnion=E7=9A=84=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/pkgs/mq/scanner/event/event.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/common/pkgs/mq/scanner/event/event.go b/common/pkgs/mq/scanner/event/event.go index d989d5f..67b8278 100644 --- a/common/pkgs/mq/scanner/event/event.go +++ b/common/pkgs/mq/scanner/event/event.go @@ -1,15 +1,14 @@ package event import ( + "gitlink.org.cn/cloudream/common/pkgs/types" myreflect "gitlink.org.cn/cloudream/common/utils/reflect" - "gitlink.org.cn/cloudream/common/utils/serder" ) type Event interface{} -var eventUnionEles = serder.NewTypeNameResolver(true) -var EventTypeUnino = serder.NewTypeUnion[Event]("@type", eventUnionEles) +var EventTypeUnino = types.NewTypeUnion[Event]() func Register[T any]() { - eventUnionEles.Register(myreflect.TypeOf[T]()) + EventTypeUnino.Add(myreflect.TypeOf[T]()) }