(value any)
| 295 | } |
| 296 | |
| 297 | func asInt(value any) (int, bool) { |
| 298 | switch typed := value.(type) { |
| 299 | case int: |
| 300 | return typed, true |
| 301 | case int64: |
| 302 | return int(typed), true |
| 303 | case float64: |
| 304 | return int(typed), typed == float64(int(typed)) |
| 305 | case json.Number: |
| 306 | number, err := typed.Int64() |
| 307 | return int(number), err == nil |
| 308 | default: |
| 309 | return 0, false |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | func cloneInt64Ptr(value *int64) *int64 { |
| 314 | if value == nil { |