Custom To use custom binders, you have to use this method. You can register them from RegisterCustomBinder method of Fiber instance. They're checked by name, if it's not found, it will return an error. NOTE: WithAutoHandling/WithAutoHandling is still valid for Custom binders.
(name string, dest any)
| 223 | // They're checked by name, if it's not found, it will return an error. |
| 224 | // NOTE: WithAutoHandling/WithAutoHandling is still valid for Custom binders. |
| 225 | func (b *Bind) Custom(name string, dest any) error { |
| 226 | binders := b.ctx.App().customBinders |
| 227 | for _, customBinder := range binders { |
| 228 | if customBinder.Name() == name { |
| 229 | if err := b.returnBindErr(customBinder.Parse(b.ctx, dest), name); err != nil { |
| 230 | return err |
| 231 | } |
| 232 | return b.validateStruct(dest) |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | return ErrCustomBinderNotFound |
| 237 | } |
| 238 | |
| 239 | // Header binds the request header strings into the struct, map[string]string and map[string][]string. |
| 240 | // Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode). |