mirror of
				https://github.com/h44z/wg-portal.git
				synced 2025-11-03 23:56:18 +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:
		@@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user