File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
backend/pkg/consapi/types Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,25 @@ func (b *Base64Bytes) UnmarshalText(text []byte) error {
3030 return nil
3131}
3232
33+ func (b * Base64Bytes ) Scan (value interface {}) error {
34+ switch v := value .(type ) {
35+ case []byte :
36+ decoded , err := base64 .StdEncoding .DecodeString (string (v ))
37+ if err != nil {
38+ return errors .Wrap (err , "failed to decode base64" )
39+ }
40+ if len (decoded ) == 0 {
41+ return fmt .Errorf ("base64 decoded string is empty" )
42+ }
43+ * b = Base64Bytes (decoded )
44+ case string :
45+ return b .UnmarshalText ([]byte (v ))
46+ default :
47+ return fmt .Errorf ("unsupported type: %T" , v )
48+ }
49+ return nil
50+ }
51+
3352type ElectraDeposit struct {
3453 Pubkey Base64Bytes `json:"pubkey" db:"pubkey"`
3554 Amount int64 `json:"amount,string" db:"amount"`
You can’t perform that action at this time.
0 commit comments