diff --git a/ginp/gin.go b/ginp/gin.go index 6bd2a4c..8a897e4 100644 --- a/ginp/gin.go +++ b/ginp/gin.go @@ -36,18 +36,23 @@ func (cy *GinCarry) SetTranslateError(e transport.ErrorTranslator) *GinCarry { cy.translate = e return cy } + +// Deprecated: Use BindURI not need this. func (*GinCarry) WithValueUri(req *http.Request, params gin.Params) *http.Request { return transportHttp.WithValueUri(req, params) } + +// Deprecated: Use BindURI not need this. +func (*GinCarry) BindUri(c *gin.Context, v any) error { + return c.ShouldBindUri(v) +} + func (*GinCarry) Bind(c *gin.Context, v any) error { return c.ShouldBind(v) } func (*GinCarry) BindQuery(c *gin.Context, v any) error { return c.ShouldBindQuery(v) } -func (*GinCarry) BindUri(c *gin.Context, v any) error { - return c.ShouldBindUri(v) -} func (*GinCarry) BindURI(c *gin.Context, _ url.Values, v any) error { return c.ShouldBindUri(v) diff --git a/ginp/ginp.go b/ginp/ginp.go index 8dc1799..0eafd24 100644 --- a/ginp/ginp.go +++ b/ginp/ginp.go @@ -57,18 +57,22 @@ func NewCarry(opts ...Option) *Carry { return cy } +// Deprecated: Use BindURI not need this. func (cy *Carry) WithValueUri(req *http.Request, params gin.Params) *http.Request { return transportHttp.WithValueUri(req, params) } + +// Deprecated: Use BindURI not need this. +func (cy *Carry) BindUri(c *gin.Context, v any) error { + return cy.encoding.BindUri(c.Request, v) +} + func (cy *Carry) Bind(c *gin.Context, v any) error { return cy.encoding.Bind(c.Request, v) } func (cy *Carry) BindQuery(c *gin.Context, v any) error { return cy.encoding.BindQuery(c.Request, v) } -func (cy *Carry) BindUri(c *gin.Context, v any) error { - return cy.encoding.BindUri(c.Request, v) -} func (cy *Carry) BindURI(c *gin.Context, raws url.Values, v any) error { return cy.encoding.BindURI(raws, v) } diff --git a/transport/http/carrier.go b/transport/http/carrier.go index 98fdb40..2cda89e 100644 --- a/transport/http/carrier.go +++ b/transport/http/carrier.go @@ -16,16 +16,17 @@ type Carrier interface { // // Deprecated: Use BindURI not need this. WithValueUri(*http.Request, gin.Params) *http.Request - // Bind checks the Method and Content-Type to select codec.Marshaler automatically, - // Depending on the "Content-Type" header different bind are used. - Bind(*gin.Context, any) error - // BindQuery binds the passed struct pointer using the query codec.Marshaler. - BindQuery(*gin.Context, any) error // BindUri binds the passed struct pointer using the uri codec.Marshaler. // NOTE: before use this, you should set uri params in the request context with RequestWithUri. // // Deprecated: Use BindURI not need this. BindUri(*gin.Context, any) error + + // Bind checks the Method and Content-Type to select codec.Marshaler automatically, + // Depending on the "Content-Type" header different bind are used. + Bind(*gin.Context, any) error + // BindQuery binds the passed struct pointer using the query codec.Marshaler. + BindQuery(*gin.Context, any) error // BindUri binds the passed struct pointer using the uri codec.Marshaler. BindURI(*gin.Context, url.Values, any) error // Error encode error response.