kcd
  • KCD ? What is that
  • Getting started
  • Handler
    • The magic behind kcd.Handler
    • How to use kcd.Handler
  • concepts
    • Handler
    • Input
    • Output
    • Hooks
    • Extractors
  • Input
    • Supported field types
    • Bind from body json
    • Bind path parameter
    • Bind query parameter
    • Bind context values
    • Bind header values
    • Default value
    • Validation
    • Exploder for slices
    • Nested fields and path system
    • Custom unmarshal (json, binary, text)
  • output
    • Returning JSON response
    • Errors
      • Throw special http status code
  • hooks & extractors
    • Override a default hook
    • Error hook
    • Render hook
    • Bind hook
    • Validate hook
    • Log hook
    • String extractor
    • Value extractor
  • Real world use case
    • Pagination
    • Conditionally render your outputs
  • Compatible with
    • Compatible with ?
    • Compatible with chi
    • Compatible with gin
    • Compatible with gorilla/mux
    • Compatible with echo
    • Compatible with the standard library
Powered by GitBook
On this page

Was this helpful?

  1. hooks & extractors

Bind hook

PreviousRender hookNextValidate hook

Last updated 4 years ago

Was this helpful?

The bind hook is the hook called to bind the incoming request body to the input structure provided in your handler.

A bind hook must have this signature:

type BindHook func(w http.ResponseWriter, r *http.Request, in interface{}) error

Check out the default .

Check out the signature of the .

bind hook implementation here
BindHook