Scan satisfies the driver.Scanner interface
(v interface{})
| 94 | |
| 95 | // Scan satisfies the driver.Scanner interface |
| 96 | func (h *Hash) Scan(v interface{}) error { |
| 97 | var buf [32]byte |
| 98 | b, ok := v.([]byte) |
| 99 | if !ok { |
| 100 | return fmt.Errorf("Hash.Scan received unsupported type %T", v) |
| 101 | } |
| 102 | if len(b) != 32 { |
| 103 | return fmt.Errorf("Hash.Scan received a bad length string %x", b) |
| 104 | } |
| 105 | copy(buf[:], b) |
| 106 | *h = NewHash(buf) |
| 107 | return nil |
| 108 | } |
| 109 | |
| 110 | // WriteTo satisfies the io.WriterTo interface. |
| 111 | func (h Hash) WriteTo(w io.Writer) (int64, error) { |