Skip to content

Commit

Permalink
stores: add []byte case to Scan
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Mar 15, 2024
1 parent c9f7eba commit deb4af4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions stores/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ func (s setting) String() string {

// Scan scans value into the setting
func (s *setting) Scan(value interface{}) error {
str, ok := value.(string)
if !ok {
return errors.New(fmt.Sprint("failed to unmarshal setting value:", value))
switch value := value.(type) {
case string:
*s = setting(value)
case []byte:
*s = setting(value)
default:
return fmt.Errorf("failed to unmarshal setting value from type %t", value)
}
*s = setting(str)
return nil
}

Expand Down

0 comments on commit deb4af4

Please sign in to comment.