MCPcopy Create free account
hub / github.com/dagger/dagger / inputBoolArg

Function inputBoolArg

dagql/cache_inputs.go:94–119  ·  view source on GitHub ↗
(args map[string]Input, argName string)

Source from the content-addressed store, hash-verified

92}
93
94func inputBoolArg(args map[string]Input, argName string) (bool, error) {
95 raw, ok := args[argName]
96 if !ok || raw == nil {
97 return false, nil
98 }
99 switch val := raw.(type) {
100 case Boolean:
101 return val.Bool(), nil
102 case Optional[Boolean]:
103 if !val.Valid {
104 return false, nil
105 }
106 return val.Value.Bool(), nil
107 case DynamicOptional:
108 if !val.Valid {
109 return false, nil
110 }
111 booleanVal, ok := val.Value.(Boolean)
112 if !ok {
113 return false, fmt.Errorf("cacheAsRequested input %q must wrap Boolean, got %T", argName, val.Value)
114 }
115 return booleanVal.Bool(), nil
116 default:
117 return false, fmt.Errorf("cacheAsRequested input %q must be Boolean, got %T", argName, raw)
118 }
119}

Callers 1

RequestedCacheInputFunction · 0.85

Calls 1

BoolMethod · 0.65

Tested by

no test coverage detected