File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -195,8 +195,13 @@ func (h Hash256) Value() (driver.Value, error) {
195
195
196
196
// Scan scan value into HostSettings, implements sql.Scanner interface.
197
197
func (hs * HostSettings ) Scan (value interface {}) error {
198
- bytes , ok := value .([]byte )
199
- if ! ok {
198
+ var bytes []byte
199
+ switch value := value .(type ) {
200
+ case string :
201
+ bytes = []byte (value )
202
+ case []byte :
203
+ bytes = value
204
+ default :
200
205
return errors .New (fmt .Sprint ("failed to unmarshal Settings value:" , value ))
201
206
}
202
207
return json .Unmarshal (bytes , hs )
@@ -212,8 +217,13 @@ func (hs HostSettings) Value() (driver.Value, error) {
212
217
213
218
// Scan scan value into PriceTable, implements sql.Scanner interface.
214
219
func (pt * PriceTable ) Scan (value interface {}) error {
215
- bytes , ok := value .([]byte )
216
- if ! ok {
220
+ var bytes []byte
221
+ switch value := value .(type ) {
222
+ case string :
223
+ bytes = []byte (value )
224
+ case []byte :
225
+ bytes = value
226
+ default :
217
227
return errors .New (fmt .Sprint ("failed to unmarshal PriceTable value:" , value ))
218
228
}
219
229
return json .Unmarshal (bytes , pt )
You can’t perform that action at this time.
0 commit comments