| 534 | } |
| 535 | |
| 536 | func (b *ValueBinder) int(sourceParam string, value string, dest any, bitSize int) *ValueBinder { |
| 537 | n, err := strconv.ParseInt(value, 10, bitSize) |
| 538 | if err != nil { |
| 539 | if bitSize == 0 { |
| 540 | b.setError(b.ErrorFunc(sourceParam, []string{value}, "failed to bind field value to int", err)) |
| 541 | } else { |
| 542 | b.setError(b.ErrorFunc(sourceParam, []string{value}, fmt.Sprintf("failed to bind field value to int%v", bitSize), err)) |
| 543 | } |
| 544 | return b |
| 545 | } |
| 546 | |
| 547 | switch d := dest.(type) { |
| 548 | case *int64: |
| 549 | *d = n |
| 550 | case *int32: |
| 551 | *d = int32(n) // #nosec G115 |
| 552 | case *int16: |
| 553 | *d = int16(n) // #nosec G115 |
| 554 | case *int8: |
| 555 | *d = int8(n) // #nosec G115 |
| 556 | case *int: |
| 557 | *d = int(n) |
| 558 | } |
| 559 | return b |
| 560 | } |
| 561 | |
| 562 | func (b *ValueBinder) intsValue(sourceParam string, dest any, valueMustExist bool) *ValueBinder { |
| 563 | if b.failFast && b.errors != nil { |