MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / getIntParam

Function getIntParam

pkg/mockpve/state.go:1544–1563  ·  view source on GitHub ↗
(params map[string]interface{}, key string, fallback int)

Source from the content-addressed store, hash-verified

1542}
1543
1544func getIntParam(params map[string]interface{}, key string, fallback int) int {
1545 value, ok := params[key]
1546 if !ok || value == nil {
1547 return fallback
1548 }
1549 switch v := value.(type) {
1550 case int:
1551 return v
1552 case float64:
1553 return int(v)
1554 case string:
1555 parsed, err := strconv.Atoi(v)
1556 if err != nil {
1557 return fallback
1558 }
1559 return parsed
1560 default:
1561 return fallback
1562 }
1563}
1564
1565func getBoolParam(params map[string]interface{}, key string, fallback bool) bool {
1566 value, ok := params[key]

Callers 3

QueueCreateGuestMethod · 0.85
buildQEMUGuestFunction · 0.85
buildLXCGuestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected