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

Method uint

binder.go:764–788  ·  view source on GitHub ↗
(sourceParam string, value string, dest any, bitSize int)

Source from the content-addressed store, hash-verified

762}
763
764func (b *ValueBinder) uint(sourceParam string, value string, dest any, bitSize int) *ValueBinder {
765 n, err := strconv.ParseUint(value, 10, bitSize)
766 if err != nil {
767 if bitSize == 0 {
768 b.setError(b.ErrorFunc(sourceParam, []string{value}, "failed to bind field value to uint", err))
769 } else {
770 b.setError(b.ErrorFunc(sourceParam, []string{value}, fmt.Sprintf("failed to bind field value to uint%v", bitSize), err))
771 }
772 return b
773 }
774
775 switch d := dest.(type) {
776 case *uint64:
777 *d = n
778 case *uint32:
779 *d = uint32(n) // #nosec G115
780 case *uint16:
781 *d = uint16(n) // #nosec G115
782 case *uint8: // byte is alias to uint8
783 *d = uint8(n) // #nosec G115
784 case *uint:
785 *d = uint(n) // #nosec G115
786 }
787 return b
788}
789
790func (b *ValueBinder) uintsValue(sourceParam string, dest any, valueMustExist bool) *ValueBinder {
791 if b.failFast && b.errors != nil {

Callers 2

uintValueMethod · 0.95
uintsMethod · 0.95

Calls 1

setErrorMethod · 0.95

Tested by

no test coverage detected