(src interface{})
| 178 | type StringMap map[string]string |
| 179 | |
| 180 | func (m *StringMap) Scan(src interface{}) error { |
| 181 | if src == nil { |
| 182 | return nil |
| 183 | } |
| 184 | switch src := src.(type) { |
| 185 | case []byte: |
| 186 | err := json.Unmarshal(src, m) |
| 187 | if err != nil { |
| 188 | return err |
| 189 | } |
| 190 | default: |
| 191 | return xerrors.Errorf("unsupported Scan, storing driver.Value type %T into type %T", src, m) |
| 192 | } |
| 193 | return nil |
| 194 | } |
| 195 | |
| 196 | func (m StringMap) Value() (driver.Value, error) { |
| 197 | return json.Marshal(m) |
no test coverage detected