worryg0d commented on code in PR #1942:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1942#discussion_r3577300569


##########
types.go:
##########
@@ -593,27 +600,88 @@ func (r *RegisteredTypes) Copy() *RegisteredTypes {
 
        copy := &RegisteredTypes{}
        copy.init()
+       copy.encodeNilMapAsNull = r.encodeNilMapAsNull
+       copy.warnOnNilMap = r.warnOnNilMap
+       // Adding default types to the copy so collection type codecs will have 
a pointer to the copy instead of the original.
+       copy.addDefaultTypes()
        for typ, t := range r.byType {
-               copy.byType[typ] = t
+               if _, exists := copy.byType[typ]; !exists {
+                       copy.byType[typ] = t
+               }
        }
        for typ, t := range r.simples {
-               copy.simples[typ] = t
+               if _, exists := copy.simples[typ]; !exists {
+                       copy.simples[typ] = t
+               }
        }
        for name, typ := range r.byString {
-               copy.byString[name] = typ
+               if _, exists := copy.byString[name]; !exists {
+                       copy.byString[name] = typ
+               }
        }
        for name, t := range r.custom {
-               copy.custom[name] = t
+               if _, exists := copy.custom[name]; !exists {
+                       copy.custom[name] = t
+               }
        }
        return copy
 }
 
+// WithNullableUDTs creates a shallow copy of the RegisteredTypes with the 
nullable UDTs flag set to the given value.
+//
+// If enabled, UDTs will be encoded as null CQL values when map is marshaled.
+//

Review Comment:
   I just realized that the generated doc renders a bit odd, so I updated it 
for proper rendering:
   
   <img width="1093" height="771" alt="image" 
src="https://github.com/user-attachments/assets/c9a74fe3-efee-4070-82a5-0404fe130001";
 />
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to