From fe5d4dd2235fa750808a75a7ba82ad90a97cda0d Mon Sep 17 00:00:00 2001 From: aoiasd <45024769+aoiasd@users.noreply.github.com> Date: Tue, 31 Dec 2024 11:22:47 +0800 Subject: [PATCH] Support push info to hook (#369) (#386) Signed-off-by: aoiasd --- go-api/hook/hook.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/go-api/hook/hook.go b/go-api/hook/hook.go index ed34eafa..94936e79 100644 --- a/go-api/hook/hook.go +++ b/go-api/hook/hook.go @@ -1,6 +1,8 @@ package hook -import "context" +import ( + "context" +) type Hook interface { Init(params map[string]string) error @@ -11,6 +13,15 @@ type Hook interface { Release() } +type LogInfo interface { + GetFields(fields []string) map[string]any +} + type Extension interface { Report(info any) int + ReportRefused(ctx context.Context, req interface{}, resp interface{}, err error, fullMethod string) error } + +type HookContextKeyType string + +const GinParamsKey = HookContextKeyType("gin_params")