MCPcopy
hub / github.com/cortexlabs/cortex / Int32PtrFromStr

Function Int32PtrFromStr

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

Source from the content-addressed store, hash-verified

95}
96
97func Int32PtrFromStr(valStr string, v *Int32PtrValidation) (*int32, error) {
98 if valStr == "" {
99 return ValidateInt32PtrMissing(v)
100 }
101 casted, castOk := s.ParseInt32(valStr)
102 if !castOk {
103 return nil, ErrorInvalidPrimitiveType(valStr, PrimTypeInt)
104 }
105 return ValidateInt32PtrProvided(&casted, v)
106}
107
108func Int32PtrFromEnv(envVarName string, v *Int32PtrValidation) (*int32, error) {
109 valStr := ReadEnvVar(envVarName)

Callers 5

Int32PtrFromStrMapFunction · 0.85
Int32PtrFromEnvFunction · 0.85
Int32PtrFromFileFunction · 0.85
Int32PtrFromPromptFunction · 0.85
StructFromStringMapFunction · 0.85

Calls 3

ValidateInt32PtrMissingFunction · 0.85
ValidateInt32PtrProvidedFunction · 0.85

Tested by

no test coverage detected