Scan fulfills the sql.Scanner interface.
(val interface{})
| 106 | |
| 107 | // Scan fulfills the sql.Scanner interface. |
| 108 | func (b *Block) Scan(val interface{}) error { |
| 109 | driverBuf, ok := val.([]byte) |
| 110 | if !ok { |
| 111 | return errors.New("Scan must receive a byte slice") |
| 112 | } |
| 113 | buf := make([]byte, len(driverBuf)) |
| 114 | copy(buf[:], driverBuf) |
| 115 | return b.FromBytes(buf) |
| 116 | } |
| 117 | |
| 118 | // Value fulfills the sql.driver.Valuer interface. |
| 119 | func (b *Block) Value() (driver.Value, error) { |