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

Function IntFromStr

pkg/lib/configreader/int.go:90–99  ·  view source on GitHub ↗
(valStr string, v *IntValidation)

Source from the content-addressed store, hash-verified

88}
89
90func IntFromStr(valStr string, v *IntValidation) (int, error) {
91 if valStr == "" {
92 return ValidateIntMissing(v)
93 }
94 casted, castOk := s.ParseInt(valStr)
95 if !castOk {
96 return 0, ErrorInvalidPrimitiveType(valStr, PrimTypeInt)
97 }
98 return ValidateIntProvided(casted, v)
99}
100
101func IntFromEnv(envVarName string, v *IntValidation) (int, error) {
102 valStr := ReadEnvVar(envVarName)

Callers 5

IntFromStrMapFunction · 0.85
IntFromEnvFunction · 0.85
IntFromFileFunction · 0.85
IntFromPromptFunction · 0.85
StructFromStringMapFunction · 0.85

Calls 3

ValidateIntMissingFunction · 0.85
ValidateIntProvidedFunction · 0.85

Tested by

no test coverage detected