Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Router ¶
func Router(incidentService 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 NewIncidentController ¶
func NewIncidentController(service Service) *Controller
NewIncidentController 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) Find ¶
func (ctrl *Controller) Find(c *gin.Context)
Find it's the handler function for filtered Component retrieve endpoints
func (*Controller) List ¶
func (ctrl *Controller) List(c *gin.Context)
List it's the handler function for Incident listing endpoints
type Read ¶
type Read interface { Find(query map[string]interface{}) ([]models.Incident, error) FindOne(query map[string]interface{}) (models.Incident, error) List(startDt time.Time, endDt time.Time, unresolved bool) ([]models.Incident, 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 { CreateIncidents(incident models.Incident) error UpdateIncident(incident models.Incident) error FindIncidents(query map[string]interface{}) ([]models.Incident, error) ListIncidents(queryParameters models.ListIncidentQueryParameters) ([]models.Incident, error) ValidateDate(startDate time.Time, endDate time.Time) error }
Service describes the use case
func NewService ¶
NewService creates implementation of the Service interface