Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
7968460fa2
|
|||
b808c5727c
|
|||
796f7956b8
|
|||
1e6b92d1d9 | |||
0b85fa5af9 |
@@ -59,7 +59,7 @@ func NewEngine(allowCors bool, ginDebug bool, bufferBody bool, timeout time.Dura
|
|||||||
// do not debug-print routes
|
// do not debug-print routes
|
||||||
gin.DebugPrintRouteFunc = func(_, _, _ string, _ int) {}
|
gin.DebugPrintRouteFunc = func(_, _, _ string, _ int) {}
|
||||||
|
|
||||||
if ginDebug {
|
if !ginDebug {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
|
|
||||||
ginlogger := gin.Logger()
|
ginlogger := gin.Logger()
|
||||||
|
@@ -61,7 +61,7 @@ func (w *GinRoutesWrapper) Use(middleware ...gin.HandlerFunc) *GinRoutesWrapper
|
|||||||
func (w *GinRoutesWrapper) WithJSONFilter(filter string) *GinRoutesWrapper {
|
func (w *GinRoutesWrapper) WithJSONFilter(filter string) *GinRoutesWrapper {
|
||||||
defHandler := langext.ArrCopy(w.defaultHandler)
|
defHandler := langext.ArrCopy(w.defaultHandler)
|
||||||
defHandler = append(defHandler, func(g *gin.Context) {
|
defHandler = append(defHandler, func(g *gin.Context) {
|
||||||
g.Set("ginext.jsonfilter", filter)
|
g.Set("goext.jsonfilter", filter)
|
||||||
})
|
})
|
||||||
return &GinRoutesWrapper{wrapper: w.wrapper, routes: w.routes, defaultHandler: defHandler}
|
return &GinRoutesWrapper{wrapper: w.wrapper, routes: w.routes, defaultHandler: defHandler}
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ func (w *GinRouteBuilder) Use(middleware ...gin.HandlerFunc) *GinRouteBuilder {
|
|||||||
|
|
||||||
func (w *GinRouteBuilder) WithJSONFilter(filter string) *GinRouteBuilder {
|
func (w *GinRouteBuilder) WithJSONFilter(filter string) *GinRouteBuilder {
|
||||||
w.handlers = append(w.handlers, func(g *gin.Context) {
|
w.handlers = append(w.handlers, func(g *gin.Context) {
|
||||||
g.Set("ginext.jsonfilter", filter)
|
g.Set("goext.jsonfilter", filter)
|
||||||
})
|
})
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.280"
|
const GoextVersion = "0.0.285"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-10-09T09:02:37+0200"
|
const GoextVersionTimestamp = "2023-10-09T15:25:30+0200"
|
||||||
|
@@ -3,6 +3,8 @@ package mongoext
|
|||||||
import (
|
import (
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/bson/bsoncodec"
|
"go.mongodb.org/mongo-driver/bson/bsoncodec"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/bsontype"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"gogs.mikescher.com/BlackForestBytes/goext/rfctime"
|
"gogs.mikescher.com/BlackForestBytes/goext/rfctime"
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
@@ -24,5 +26,9 @@ func CreateGoExtBsonRegistry() *bsoncodec.Registry {
|
|||||||
|
|
||||||
bson.PrimitiveCodecs{}.RegisterPrimitiveCodecs(rb)
|
bson.PrimitiveCodecs{}.RegisterPrimitiveCodecs(rb)
|
||||||
|
|
||||||
|
// otherwise we get []primitve.E when unmarshalling into any
|
||||||
|
// which will result in {'key': .., 'value': ...}[] json when json-marshalling
|
||||||
|
rb.RegisterTypeMapEntry(bsontype.EmbeddedDocument, reflect.TypeOf(primitive.M{}))
|
||||||
|
|
||||||
return rb.Build()
|
return rb.Build()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user