Skip to content

Commit

Permalink
fix(crypto): sql char support
Browse files Browse the repository at this point in the history
  • Loading branch information
oddyamill committed Oct 28, 2024
1 parent 9b6713e commit 88da581
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ func (c *Crypt) Decrypt() string {
}

func (c *Crypt) Scan(src any) error {
text, ok := src.(string)

if !ok {
return nil
switch value := src.(type) {
case string:
c.Encrypted = value
case []byte:
c.Encrypted = helpers.BytesToString(value)
case nil:
c.Encrypted = ""
default:
return errors.New("unsupported type")
}

c.Encrypted = text
return nil
}

0 comments on commit 88da581

Please sign in to comment.