diff options
Diffstat (limited to 'vendor/github.com/uptrace/bun/hook.go')
-rw-r--r-- | vendor/github.com/uptrace/bun/hook.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vendor/github.com/uptrace/bun/hook.go b/vendor/github.com/uptrace/bun/hook.go index 81249329a..016f06a1a 100644 --- a/vendor/github.com/uptrace/bun/hook.go +++ b/vendor/github.com/uptrace/bun/hook.go @@ -6,6 +6,7 @@ import ( "strings" "sync/atomic" "time" + "unicode" "github.com/uptrace/bun/schema" ) @@ -35,13 +36,15 @@ func (e *QueryEvent) Operation() string { } func queryOperation(query string) string { - if idx := strings.IndexByte(query, ' '); idx > 0 { - query = query[:idx] + queryOp := strings.TrimLeftFunc(query, unicode.IsSpace) + + if idx := strings.IndexByte(queryOp, ' '); idx > 0 { + queryOp = queryOp[:idx] } - if len(query) > 16 { - query = query[:16] + if len(queryOp) > 16 { + queryOp = queryOp[:16] } - return query + return queryOp } type QueryHook interface { |