UnmarshalText fulfills the encoding.TextUnmarshaler interface.
(text []byte)
| 96 | |
| 97 | // UnmarshalText fulfills the encoding.TextUnmarshaler interface. |
| 98 | func (b *Block) UnmarshalText(text []byte) error { |
| 99 | decoded := make([]byte, hex.DecodedLen(len(text))) |
| 100 | _, err := hex.Decode(decoded, text) |
| 101 | if err != nil { |
| 102 | return err |
| 103 | } |
| 104 | return b.FromBytes(decoded) |
| 105 | } |
| 106 | |
| 107 | // Scan fulfills the sql.Scanner interface. |
| 108 | func (b *Block) Scan(val interface{}) error { |