Ensure strings are converted to records if possible

This commit is contained in:
Tobie Morgan Hitchcock 2021-04-17 15:01:16 +01:00
parent 4849eb4486
commit d476bec5a2

View file

@ -202,6 +202,10 @@ func ConvertToRecord(obj interface{}, tb string) (val *sql.Thing, err error) {
default: default:
err = fmt.Errorf("Expected a record of type '%s', but found '%v'", tb, obj) err = fmt.Errorf("Expected a record of type '%s', but found '%v'", tb, obj)
} }
case string:
if val = sql.ParseThing(now); val == nil {
err = fmt.Errorf("Expected a record of type '%s', but found '%v'", tb, obj)
}
default: default:
switch tb { switch tb {
default: default: