Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
592fae25af
|
|||
7968460fa2
|
|||
b808c5727c
|
|||
796f7956b8
|
|||
1e6b92d1d9 | |||
0b85fa5af9 |
@@ -35,7 +35,7 @@ var rexEnumPackage = rext.W(regexp.MustCompile(`^package\s+(?P<name>[A-Za-z0-9_]
|
|||||||
|
|
||||||
var rexEnumDef = rext.W(regexp.MustCompile(`^\s*type\s+(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*//\s*(@enum:type).*$`))
|
var rexEnumDef = rext.W(regexp.MustCompile(`^\s*type\s+(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*//\s*(@enum:type).*$`))
|
||||||
|
|
||||||
var rexEnumValueDef = rext.W(regexp.MustCompile(`^\s*(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*=\s*(?P<value>("[A-Za-z0-9_:]+"|[0-9]+))\s*(//(?P<descr>.*))?.*$`))
|
var rexEnumValueDef = rext.W(regexp.MustCompile(`^\s*(?P<name>[A-Za-z0-9_]+)\s+(?P<type>[A-Za-z0-9_]+)\s*=\s*(?P<value>("[A-Za-z0-9_:\s]+"|[0-9]+))\s*(//(?P<descr>.*))?.*$`))
|
||||||
|
|
||||||
var rexEnumChecksumConst = rext.W(regexp.MustCompile(`const ChecksumEnumGenerator = "(?P<cs>[A-Za-z0-9_]*)"`))
|
var rexEnumChecksumConst = rext.W(regexp.MustCompile(`const ChecksumEnumGenerator = "(?P<cs>[A-Za-z0-9_]*)"`))
|
||||||
|
|
||||||
|
@@ -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
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@@ -41,7 +41,7 @@ require (
|
|||||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||||
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
|
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
|
||||||
golang.org/x/arch v0.5.0 // indirect
|
golang.org/x/arch v0.5.0 // indirect
|
||||||
golang.org/x/net v0.16.0 // indirect
|
golang.org/x/net v0.17.0 // indirect
|
||||||
golang.org/x/sync v0.4.0 // indirect
|
golang.org/x/sync v0.4.0 // indirect
|
||||||
golang.org/x/text v0.13.0 // indirect
|
golang.org/x/text v0.13.0 // indirect
|
||||||
google.golang.org/protobuf v1.31.0 // indirect
|
google.golang.org/protobuf v1.31.0 // indirect
|
||||||
|
2
go.sum
2
go.sum
@@ -121,6 +121,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos=
|
golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos=
|
||||||
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||||
|
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||||
|
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.280"
|
const GoextVersion = "0.0.286"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-10-09T09:02:37+0200"
|
const GoextVersionTimestamp = "2023-10-11T11:27:18+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