MCPcopy Create free account
hub / github.com/cortexlabs/cortex / Int32FromStr

Function Int32FromStr

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

Source from the content-addressed store, hash-verified

88}
89
90func Int32FromStr(valStr string, v *Int32Validation) (int32, error) {
91 if valStr == "" {
92 return ValidateInt32Missing(v)
93 }
94 casted, castOk := s.ParseInt32(valStr)
95 if !castOk {
96 return 0, ErrorInvalidPrimitiveType(valStr, PrimTypeInt)
97 }
98 return ValidateInt32Provided(casted, v)
99}
100
101func Int32FromEnv(envVarName string, v *Int32Validation) (int32, error) {
102 valStr := ReadEnvVar(envVarName)

Callers 5

StructFromStringMapFunction · 0.85
Int32FromStrMapFunction · 0.85
Int32FromEnvFunction · 0.85
Int32FromFileFunction · 0.85
Int32FromPromptFunction · 0.85

Calls 3

ValidateInt32MissingFunction · 0.85
ValidateInt32ProvidedFunction · 0.85

Tested by

no test coverage detected