MCPcopy Index your code
hub / github.com/labstack/echo / TextUnmarshaler

Method TextUnmarshaler

binder.go:385–399  ·  view source on GitHub ↗

TextUnmarshaler binds parameter to destination implementing encoding.TextUnmarshaler interface

(sourceParam string, dest encoding.TextUnmarshaler)

Source from the content-addressed store, hash-verified

383
384// TextUnmarshaler binds parameter to destination implementing encoding.TextUnmarshaler interface
385func (b *ValueBinder) TextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder {
386 if b.failFast && b.errors != nil {
387 return b
388 }
389
390 tmp := b.ValueFunc(sourceParam)
391 if tmp == "" {
392 return b
393 }
394
395 if err := dest.UnmarshalText([]byte(tmp)); err != nil {
396 b.setError(b.ErrorFunc(sourceParam, []string{tmp}, "failed to bind field value to encoding.TextUnmarshaler interface", err))
397 }
398 return b
399}
400
401// MustTextUnmarshaler requires parameter value to exist to bind to destination implementing encoding.TextUnmarshaler interface.
402// Returns error when value does not exist

Callers 1

Calls 2

setErrorMethod · 0.95
UnmarshalTextMethod · 0.80

Tested by 1