MCPcopy Index your code
hub / github.com/labstack/echo / MustString

Method MustString

binder.go:269–281  ·  view source on GitHub ↗

MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist

(sourceParam string, dest *string)

Source from the content-addressed store, hash-verified

267
268// MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist
269func (b *ValueBinder) MustString(sourceParam string, dest *string) *ValueBinder {
270 if b.failFast && b.errors != nil {
271 return b
272 }
273
274 value := b.ValueFunc(sourceParam)
275 if value == "" {
276 b.setError(b.ErrorFunc(sourceParam, []string{value}, "required field value is empty", nil))
277 return b
278 }
279 *dest = value
280 return b
281}
282
283// Strings binds parameter values to slice of string
284func (b *ValueBinder) Strings(sourceParam string, dest *[]string) *ValueBinder {

Callers 1

TestValueBinder_StringFunction · 0.80

Calls 1

setErrorMethod · 0.95

Tested by 1

TestValueBinder_StringFunction · 0.64