v0.0.339
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m5s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m5s
This commit is contained in:
parent
c3162fec95
commit
68e63a9cf6
@ -6,8 +6,10 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/mathext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/rext"
|
||||
"net"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@ -126,7 +128,7 @@ func (w *GinWrapper) DebugPrintRoutes() {
|
||||
line := [4]string{
|
||||
spec.Method,
|
||||
spec.URL,
|
||||
strings.Join(spec.Middlewares, " -> "),
|
||||
strings.Join(langext.ArrMap(spec.Middlewares, w.cleanMiddlewareName), " -> "),
|
||||
spec.Handler,
|
||||
}
|
||||
|
||||
@ -147,3 +149,28 @@ func (w *GinWrapper) DebugPrintRoutes() {
|
||||
langext.StrPadRight(line[3], " ", pad[3]))
|
||||
}
|
||||
}
|
||||
|
||||
func (w *GinWrapper) cleanMiddlewareName(fname string) string {
|
||||
|
||||
funcSuffix := rext.W(regexp.MustCompile(`\.func[0-9]+(?:\.[0-9]+)*$`))
|
||||
if match, ok := funcSuffix.MatchFirst(fname); ok {
|
||||
fname = fname[:len(fname)-match.FullMatch().Length()]
|
||||
}
|
||||
|
||||
if strings.HasSuffix(fname, ".(*GinRoutesWrapper).WithJSONFilter") {
|
||||
fname = "[JSONFilter]"
|
||||
}
|
||||
|
||||
if fname == "ginext.BodyBuffer" {
|
||||
fname = "[BodyBuffer]"
|
||||
}
|
||||
|
||||
skipPrefixes := []string{"api.(*Handler).", "api."}
|
||||
for _, pfx := range skipPrefixes {
|
||||
if strings.HasPrefix(fname, pfx) {
|
||||
fname = fname[len(pfx):]
|
||||
}
|
||||
}
|
||||
|
||||
return fname
|
||||
}
|
||||
|
@ -3,11 +3,9 @@ package ginext
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/rext"
|
||||
"net/http"
|
||||
"path"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
@ -196,12 +194,6 @@ func nameOfFunction(f any) string {
|
||||
fname = fname[:len(fname)-len("-fm")]
|
||||
}
|
||||
|
||||
suffix := rext.W(regexp.MustCompile(`\.func[0-9]+(?:\.[0-9]+)*$`))
|
||||
|
||||
if match, ok := suffix.MatchFirst(fname); ok {
|
||||
fname = fname[:len(fname)-match.FullMatch().Length()]
|
||||
}
|
||||
|
||||
return fname
|
||||
}
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -7,7 +7,7 @@ require (
|
||||
github.com/jmoiron/sqlx v1.3.5
|
||||
github.com/rs/xid v1.5.0
|
||||
github.com/rs/zerolog v1.31.0
|
||||
go.mongodb.org/mongo-driver v1.13.0
|
||||
go.mongodb.org/mongo-driver v1.13.1
|
||||
golang.org/x/crypto v0.16.0
|
||||
golang.org/x/sys v0.15.0
|
||||
golang.org/x/term v0.15.0
|
||||
|
2
go.sum
2
go.sum
@ -126,6 +126,8 @@ go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecq
|
||||
go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
|
||||
go.mongodb.org/mongo-driver v1.13.0 h1:67DgFFjYOCMWdtTEmKFpV3ffWlFnh+CYZ8ZS/tXWUfY=
|
||||
go.mongodb.org/mongo-driver v1.13.0/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
|
||||
go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk=
|
||||
go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y=
|
||||
golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
|
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.338"
|
||||
const GoextVersion = "0.0.339"
|
||||
|
||||
const GoextVersionTimestamp = "2023-12-05T19:50:24+0100"
|
||||
const GoextVersionTimestamp = "2023-12-07T10:54:36+0100"
|
||||
|
Loading…
Reference in New Issue
Block a user