(value interface{})
| 1533 | } |
| 1534 | |
| 1535 | func toInt(value interface{}) int { |
| 1536 | switch v := value.(type) { |
| 1537 | case int: |
| 1538 | return v |
| 1539 | case int64: |
| 1540 | return int(v) |
| 1541 | case float64: |
| 1542 | return int(v) |
| 1543 | case string: |
| 1544 | if v == "" { |
| 1545 | return 0 |
| 1546 | } |
| 1547 | parsed, _ := strconv.Atoi(v) |
| 1548 | return parsed |
| 1549 | default: |
| 1550 | return 0 |
| 1551 | } |
| 1552 | } |
| 1553 | |
| 1554 | func normalizeCustomModel(modelName string) string { |
| 1555 | trim := strings.TrimSpace(modelName) |