Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mnvx committed Aug 13, 2020
1 parent c1fb5f3 commit 9e76d47
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,32 @@
## How to use

```bash
package controller
package gin_crud

import (
"github.com/gin-gonic/gin"
"github.com/zubroide/gorm-crud/common"
"github.com/zubroide/gorm-crud/repository"
"github.com/zubroide/gorm-crud/service"
"github.com/zubroide/gorm-crud"
"net/http"
"reflect"
"strconv"
)


type ParametersHydratorInterface interface {
Hydrate(context *gin.Context) (repository.ListParametersInterface, error)
Hydrate(context *gin.Context) (gorm_crud.ListParametersInterface, error)
}

type BaseParametersHydrator struct {
logger common.LoggerInterface
logger gorm_crud.LoggerInterface
ParametersHydratorInterface
}

func NewBaseParametersHydrator(logger common.LoggerInterface) ParametersHydratorInterface {
func NewBaseParametersHydrator(logger gorm_crud.LoggerInterface) ParametersHydratorInterface {
return &BaseParametersHydrator{logger: logger}
}

func (c BaseParametersHydrator) Hydrate(context *gin.Context) (repository.ListParametersInterface, error) {
var parameters repository.CrudListParameters
func (c BaseParametersHydrator) Hydrate(context *gin.Context) (gorm_crud.ListParametersInterface, error) {
var parameters gorm_crud.CrudListParameters
err := context.ShouldBindQuery(&parameters)
return &parameters, err
}
Expand All @@ -55,11 +53,11 @@ type CrudControllerInterface interface {
type CrudController struct {
CrudControllerInterface
*BaseController
service service.CrudServiceInterface
service gorm_crud.CrudServiceInterface
parametersHydrator ParametersHydratorInterface
}

func NewCrudController(service service.CrudServiceInterface, parametersHydrator ParametersHydratorInterface, logger common.LoggerInterface) *CrudController {
func NewCrudController(service gorm_crud.CrudServiceInterface, parametersHydrator ParametersHydratorInterface, logger gorm_crud.LoggerInterface) *CrudController {
controller := NewBaseController(logger)
return &CrudController{BaseController: controller, service: service, parametersHydrator: parametersHydrator}
}
Expand Down

0 comments on commit 9e76d47

Please sign in to comment.