Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Router ¶
func Router(clientService Service, router *gin.RouterGroup)
Router creates a new Controller and add all available endpoints to a Gin RouterGroup
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller contains all the available handlers
func NewClientController ¶
func NewClientController(service Service) *Controller
NewClientController creates a new Controller
func (*Controller) Create ¶
func (ctrl *Controller) Create(c *gin.Context)
Create it's the handler function for Client creation endpoints
func (*Controller) Delete ¶
func (ctrl *Controller) Delete(c *gin.Context)
Delete it's the handler function for Client deletion endpoints
func (*Controller) Find ¶
func (ctrl *Controller) Find(c *gin.Context)
Find it's the handler function for filtered Client retrieve endpoints
func (*Controller) List ¶
func (ctrl *Controller) List(c *gin.Context)
List it's the handler function for Client listing endpoints
func (*Controller) Update ¶
func (ctrl *Controller) Update(c *gin.Context)
Update it's the handler function for Client update endpoints
type Read ¶
type Read interface { Find(queryParam map[string]interface{}) (models.Client, error) List() ([]models.Client, error) }
Read implements the read action methods
type Repository ¶
Repository describes the repository where the data will be written and read from
func NewMongoRepository ¶
func NewMongoRepository(session *mgo.Session) Repository
NewMongoRepository creates a new Repository implementation using the MongoDB as database
type Service ¶
type Service interface { CreateClient(client models.Client) (string, error) FindClient(queryParam map[string]interface{}) (models.Client, error) ListClients() ([]models.Client, error) RemoveClient(clientRef string) error UpdateClient(clientRef string, client models.Client) error }
Service describes the use case
func NewService ¶
func NewService(r Repository, component component.Service) Service
NewService creates implementation of the Service interface