(VDB-1230) Add type whitelist to PersistModels#72
Conversation
|
|
||
| func isValidValue(value interface{}) bool { | ||
| switch value.(type) { | ||
| case *pq.StringArray: |
There was a problem hiding this comment.
Not really sure why driver.IsValue doesn't consider this a valid type. But pq.StringArray definitely works with the tx.Exec function; in fact I'm pretty sure that's the type's main use-case.
There was a problem hiding this comment.
I wonder if driver.IsValue doesn't return true because a driver doesn't necessarily have to implement a string array? 🤔
There was a problem hiding this comment.
Sounds legit! Tbh I'm not totally sure what the driver is; I kind of assumed it was responsible for converting Go values into something that Postgres can understand. But I guess I must be misunderstanding/missing something 😅
|
|
||
| func isValidValue(value interface{}) bool { | ||
| switch value.(type) { | ||
| case *pq.StringArray: |
There was a problem hiding this comment.
I wonder if driver.IsValue doesn't return true because a driver doesn't necessarily have to implement a string array? 🤔
Small change allowing
PersistModelsto accept values of the type*pq.StringArray, to make it easier to deal with inserting values into Postgres array columns.