2
0

fix concurrency bug in pgtype.defaultMap (#1650)

This commit is contained in:
Lev Zakharov
2023-06-18 15:36:48 +03:00
committed by Jack Christensen
parent 9a5ead9048
commit 7c386112e3
2 changed files with 2 additions and 4 deletions
-4
View File
@@ -318,10 +318,6 @@ func (m *Map) TypeForValue(v any) (*Type, bool) {
return dt, true
}
if defaultMap.reflectTypeToType == nil {
defaultMap.buildReflectTypeToType()
}
dt, ok := defaultMap.reflectTypeToType[reflect.TypeOf(v)]
return dt, ok
}
+2
View File
@@ -218,4 +218,6 @@ func initDefaultMap() {
registerDefaultPgTypeVariants[Range[Timestamptz]](defaultMap, "tstzrange")
registerDefaultPgTypeVariants[Multirange[Range[Timestamptz]]](defaultMap, "tstzmultirange")
registerDefaultPgTypeVariants[UUID](defaultMap, "uuid")
defaultMap.buildReflectTypeToType()
}