From d7fbef37dbee1db5087d1201de1ed4400eba4fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 15 Sep 2024 18:22:07 +0200 Subject: [PATCH] v0.0.511 --- ginext/responseJson.go | 16 ++++++++++++---- goextVersion.go | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ginext/responseJson.go b/ginext/responseJson.go index 9b070c3..42a6f68 100644 --- a/ginext/responseJson.go +++ b/ginext/responseJson.go @@ -7,10 +7,11 @@ import ( ) type jsonHTTPResponse struct { - statusCode int - data any - headers []headerval - cookies []cookieval + statusCode int + data any + headers []headerval + cookies []cookieval + filterOverride *string } func (j jsonHTTPResponse) jsonRenderer(g *gin.Context) json.GoJsonRender { @@ -18,6 +19,9 @@ func (j jsonHTTPResponse) jsonRenderer(g *gin.Context) json.GoJsonRender { if jsonfilter := g.GetString(jsonFilterKey); jsonfilter != "" { f = &jsonfilter } + if j.filterOverride != nil { + f = j.filterOverride + } return json.GoJsonRender{Data: j.data, NilSafeSlices: true, NilSafeMaps: true, Filter: f} } @@ -68,3 +72,7 @@ func (j jsonHTTPResponse) Headers() []string { func JSON(sc int, data any) HTTPResponse { return &jsonHTTPResponse{statusCode: sc, data: data} } + +func JSONWithFilter(sc int, data any, f string) HTTPResponse { + return &jsonHTTPResponse{statusCode: sc, data: data, filterOverride: &f} +} diff --git a/goextVersion.go b/goextVersion.go index 4f1ef01..1f83311 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.510" +const GoextVersion = "0.0.511" -const GoextVersionTimestamp = "2024-09-13T18:06:49+0200" +const GoextVersionTimestamp = "2024-09-15T18:22:07+0200"