MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / GetString

Method GetString

pkg/event/param.go:239–248  ·  view source on GitHub ↗

GetString returns the underlying string value from the parameter.

(name string)

Source from the content-addressed store, hash-verified

237
238// GetString returns the underlying string value from the parameter.
239func (pars Params) GetString(name string) (string, error) {
240 par, err := pars.findParam(name)
241 if err != nil {
242 return "", err
243 }
244 if _, ok := par.Value.(string); !ok {
245 return "", fmt.Errorf("unable to type cast %q parameter to string value", name)
246 }
247 return par.Value.(string), nil
248}
249
250// MustGetString returns the string parameter or panics
251// if an error occurs while trying to get the parameter.

Callers 15

TestParamsFunction · 0.95
MustGetStringMethod · 0.95
TestTransformFunction · 0.45
TestTransformFunction · 0.45
unwrapHandleFunction · 0.45
InitFromViperMethod · 0.45
initFromViperMethod · 0.45
GetConfigFileMethod · 0.45
InitMethod · 0.45
ValidateMethod · 0.45
FileMethod · 0.45
initFromViperMethod · 0.45

Calls 1

findParamMethod · 0.95

Tested by 4

TestParamsFunction · 0.76
TestTransformFunction · 0.36
TestTransformFunction · 0.36
TestMarshallerFunction · 0.36