mirror of
https://github.com/arnaucube/go-iden3-crypto.git
synced 2026-02-07 11:36:41 +01:00
Add scanner/valuer interface to babyjub.SignatureComp
This commit is contained in:
@@ -177,6 +177,24 @@ func (s *SignatureComp) Decompress() (*Signature, error) {
|
||||
return new(Signature).Decompress(*s)
|
||||
}
|
||||
|
||||
// Scan implements Scanner for database/sql.
|
||||
func (s *SignatureComp) Scan(src interface{}) error {
|
||||
srcB, ok := src.([]byte)
|
||||
if !ok {
|
||||
return fmt.Errorf("can't scan %T into Signature", src)
|
||||
}
|
||||
if len(srcB) != 64 {
|
||||
return fmt.Errorf("can't scan []byte of len %d into Signature, want %d", len(srcB), 64)
|
||||
}
|
||||
copy(s[:], srcB[:])
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value implements valuer for database/sql.
|
||||
func (s SignatureComp) Value() (driver.Value, error) {
|
||||
return s[:], nil
|
||||
}
|
||||
|
||||
// Scan implements Scanner for database/sql.
|
||||
func (s *Signature) Scan(src interface{}) error {
|
||||
srcB, ok := src.([]byte)
|
||||
|
||||
Reference in New Issue
Block a user