customer/internal/utils/bind.go

14 lines
205 B
Go
Raw Normal View History

2023-05-17 20:27:09 +00:00
package utils
import "github.com/labstack/echo/v4"
func EchoBind[T any](ctx echo.Context) (*T, error) {
item := new(T)
if err := ctx.Bind(item); err != nil {
return nil, err
}
return item, nil
}