worryg0d commented on code in PR #1791:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1791#discussion_r1706791549
##########
metadata.go:
##########
@@ -975,69 +977,207 @@ func getViewsMetadata(session *Session, keyspaceName
string) ([]ViewMetadata, er
return views, nil
}
+func extensionsBlobToStrings(value interface{}) (map[string]string, error) {
+ const errorMessage = "gocql.extensionsBlobToStrings failed to read
column %s"
+ byteData, ok := value.(map[string][]byte)
+ if !ok {
+ return nil, fmt.Errorf(errorMessage, "extentions")
+ }
+
+ extensions := make(map[string]string, len(byteData))
+ for key, rowByte := range byteData {
+ extensions[key] = string(rowByte)
+ }
+
+ return extensions, nil
+}
Review Comment:
```suggestion
func bytesMapToStringMap(bytesMap map[string][]byte) map[string]string {
stringMap := make(map[string]string, len(bytesMap))
for key, bytes := range bytesMap {
stringMap[key] = string(bytes)
}
return stringMap
}
```
Let's make this method take `map[string][]byte` as a param instead of an
empty interface. This approach will allow you to return described in this func
error more properly from `materializedViewMetadataFromMap`.
Also, what do you think about renaming this func to something like
`bytesMapToStringMap`?
--
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]