MCPcopy Create free account
hub / github.com/chain/txvm / UnmarshalText

Method UnmarshalText

protocol/bc/block.go:98–105  ·  view source on GitHub ↗

UnmarshalText fulfills the encoding.TextUnmarshaler interface.

(text []byte)

Source from the content-addressed store, hash-verified

96
97// UnmarshalText fulfills the encoding.TextUnmarshaler interface.
98func (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.
108func (b *Block) Scan(val interface{}) error {

Callers 1

mustDecodeBlockHexFunction · 0.95

Calls 2

FromBytesMethod · 0.95
DecodeMethod · 0.80

Tested by 1

mustDecodeBlockHexFunction · 0.76