deprecated.go 762 B

1234567891011121314151617181920212223
  1. // Copyright 2014 Manu Martinez-Almeida. All rights reserved.
  2. // Use of this source code is governed by a MIT style
  3. // license that can be found in the LICENSE file.
  4. package gin
  5. import (
  6. "log"
  7. "github.com/gin-gonic/gin/binding"
  8. )
  9. // BindWith binds the passed struct pointer using the specified binding engine.
  10. // See the binding package.
  11. //
  12. // Deprecated: Use MustBindWith or ShouldBindWith.
  13. func (c *Context) BindWith(obj any, b binding.Binding) error {
  14. log.Println(`BindWith(\"any, binding.Binding\") error is going to
  15. be deprecated, please check issue #662 and either use MustBindWith() if you
  16. want HTTP 400 to be automatically returned if any error occur, or use
  17. ShouldBindWith() if you need to manage the error.`)
  18. return c.MustBindWith(obj, b)
  19. }