File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,14 @@ type AccountConfig struct {
112112
113113// For serializing from db
114114func (c * AccountConfig ) Scan (src any ) error {
115- data , ok := src .([]byte )
116- if ! ok {
117- return fmt .Errorf ("tried to scan from %T instead of bytes" , src )
115+ var data []byte
116+ switch v := src .(type ) {
117+ case []byte :
118+ data = v
119+ case string :
120+ data = []byte (v )
121+ default :
122+ return fmt .Errorf ("tried to scan from %T instead of string or bytes" , src )
118123 }
119124
120125 return json .Unmarshal (data , & c )
@@ -142,9 +147,14 @@ type AgentReport struct {
142147
143148// For serializing from db
144149func (r * AgentReport ) Scan (src any ) error {
145- data , ok := src .([]byte )
146- if ! ok {
147- return fmt .Errorf ("tried to scan from %T instead of bytes" , src )
150+ var data []byte
151+ switch v := src .(type ) {
152+ case []byte :
153+ data = v
154+ case string :
155+ data = []byte (v )
156+ default :
157+ return fmt .Errorf ("tried to scan from %T instead of string or bytes" , src )
148158 }
149159
150160 return json .Unmarshal (data , & r )
You can’t perform that action at this time.
0 commit comments