Documentation ¶
Index ¶
- func Router(componentService Service, router *gin.RouterGroup)
- type Controller
- func (ctrl *Controller) Create(c *gin.Context)
- func (ctrl *Controller) Delete(c *gin.Context)
- func (ctrl *Controller) Find(c *gin.Context)
- func (ctrl *Controller) FindWithLabelFilter(c *gin.Context)
- func (ctrl *Controller) List(c *gin.Context)
- func (ctrl *Controller) ListExistentLabels(c *gin.Context)
- func (ctrl *Controller) Update(c *gin.Context)
- type Read
- type Repository
- type Service
- type Write
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Router ¶
func Router(componentService 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 NewComponentController ¶
func NewComponentController(service Service) *Controller
NewComponentController creates a new Controller
func (*Controller) Create ¶
func (ctrl *Controller) Create(c *gin.Context)
Create it's the handler function for Component creation endpoints
func (*Controller) Delete ¶
func (ctrl *Controller) Delete(c *gin.Context)
Delete it's the handler function for Component deletion endpoints
func (*Controller) Find ¶
func (ctrl *Controller) Find(c *gin.Context)
Find it's the handler function for filtered Component retrieve endpoints
func (*Controller) FindWithLabelFilter ¶
func (ctrl *Controller) FindWithLabelFilter(c *gin.Context)
FindWithLabelFilter it's the handler function for Component retrieve filtered by labels
func (*Controller) List ¶
func (ctrl *Controller) List(c *gin.Context)
List it's the handler function for Component listing endpoints
func (*Controller) ListExistentLabels ¶
func (ctrl *Controller) ListExistentLabels(c *gin.Context)
ListExistentLabels it's the handler function that lists all existent labels
func (*Controller) Update ¶
func (ctrl *Controller) Update(c *gin.Context)
Update it's the handler function for Component update endpoints
type Read ¶
type Read interface { Find(queryParam map[string]interface{}) (models.Component, error) FindAllWithLabel(label string) ([]models.Component, error) List() ([]models.Component, error) ListAllLabels() (models.ComponentLabels, 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 { ComponentExists(map[string]interface{}) (models.Component, bool) CreateComponent(component models.Component) (string, error) FindComponent(queryParam map[string]interface{}) (models.Component, error) ListComponents(refs []string) ([]models.Component, error) RemoveComponent(componentRef string) error UpdateComponent(componentRef string, component models.Component) error ListAllLabels() (models.ComponentLabels, error) ListComponentsWithLabels(labels models.ComponentLabels) ([]models.Component, error) }
Service describes the use case
func NewService ¶
func NewService(r Repository, l logs.Log) Service
NewService creates implementation of the Service interface