Skip to content

Commit

Permalink
fix: enhance PrivateString Scan method to support []byte input (#324)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmytro Bondar <[email protected]>
  • Loading branch information
bonddim authored Nov 26, 2024
1 parent f7c3bdf commit 90a570b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/domain/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ func (ps *PrivateString) Scan(value interface{}) error {
*ps = ""
return nil
}
strValue, ok := value.(string)
if !ok {
switch v := value.(type) {
case string:
*ps = PrivateString(v)
case []byte:
*ps = PrivateString(string(v))
default:
return errors.New("invalid type for PrivateString")
}
*ps = PrivateString(strValue)
return nil
}

Expand Down

0 comments on commit 90a570b

Please sign in to comment.