Scan satisfies the database.sql.Scanner interface.
(val interface{})
| 61 | |
| 62 | // Scan satisfies the database.sql.Scanner interface. |
| 63 | func (bh *BlockHeader) Scan(val interface{}) error { |
| 64 | driverBuf, ok := val.([]byte) |
| 65 | if !ok { |
| 66 | return errors.New("Scan must receive a byte slice") |
| 67 | } |
| 68 | buf := make([]byte, len(driverBuf)) |
| 69 | copy(buf, driverBuf) |
| 70 | return proto.Unmarshal(buf, bh) |
| 71 | } |
| 72 | |
| 73 | // Value satisfies the Valuer interface from database/sql/driver. |
| 74 | func (bh *BlockHeader) Value() (driver.Value, error) { |