MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist
(sourceParam string, dest *string)
| 267 | |
| 268 | // MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist |
| 269 | func (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 |
| 284 | func (b *ValueBinder) Strings(sourceParam string, dest *[]string) *ValueBinder { |