Optimize marshalling for jsonb types (#19898)
We check for the presence of binary_parameters in the DSN and add the 0x01 byte accordingly. This helps us avoid casting to string and efficiently use the database. ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ec91ca46ff
Коммит
2e027ae927
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||
)
|
||||
|
||||
@@ -137,6 +138,14 @@ func constructArrayArgs(ids []string) (string, []interface{}) {
|
||||
return "(" + placeholder.String() + ")", values
|
||||
}
|
||||
|
||||
func wrapBinaryParamStringMap(ok bool, props model.StringMap) model.StringMap {
|
||||
if props == nil {
|
||||
props = make(model.StringMap)
|
||||
}
|
||||
props[model.BinaryParamKey] = strconv.FormatBool(ok)
|
||||
return props
|
||||
}
|
||||
|
||||
// morphWriter is a target to pass to the logger instance of morph.
|
||||
// For now, everything is just logged at a debug level. If we need to log
|
||||
// errors/warnings from the library also, that needs to be seen later.
|
||||
|
||||
Ссылка в новой задаче
Block a user