MCPcopy Index your code
hub / github.com/cortexlabs/cortex / IntPtrFromStr

Function IntPtrFromStr

pkg/lib/configreader/int_ptr.go:97–106  ·  view source on GitHub ↗
(valStr string, v *IntPtrValidation)

Source from the content-addressed store, hash-verified

95}
96
97func IntPtrFromStr(valStr string, v *IntPtrValidation) (*int, error) {
98 if valStr == "" {
99 return ValidateIntPtrMissing(v)
100 }
101 casted, castOk := s.ParseInt(valStr)
102 if !castOk {
103 return nil, ErrorInvalidPrimitiveType(valStr, PrimTypeInt)
104 }
105 return ValidateIntPtrProvided(&casted, v)
106}
107
108func IntPtrFromEnv(envVarName string, v *IntPtrValidation) (*int, error) {
109 valStr := ReadEnvVar(envVarName)

Callers 5

IntPtrFromStrMapFunction · 0.85
IntPtrFromEnvFunction · 0.85
IntPtrFromFileFunction · 0.85
IntPtrFromPromptFunction · 0.85
StructFromStringMapFunction · 0.85

Calls 3

ValidateIntPtrMissingFunction · 0.85
ValidateIntPtrProvidedFunction · 0.85

Tested by

no test coverage detected