mirror of
https://github.com/h44z/wg-portal
synced 2025-02-26 05:49:14 +00:00
fix: enhance PrivateString Scan method to support []byte input (#324)
Signed-off-by: Dmytro Bondar <git@bonddim.com>
This commit is contained in:
parent
f7c3bdf456
commit
90a570bd66
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user