Documentation
¶
Overview ¶
Package gin input
Package gin input ¶
Package gin input ¶
Package gin input
Index ¶
- type CustomDTO
- type FullDTO
- func (dto *FullDTO) Arrival() string
- func (dto *FullDTO) Created() int64
- func (dto *FullDTO) Departure() string
- func (dto *FullDTO) From() int64
- func (dto *FullDTO) Id() string
- func (dto *FullDTO) Miles() int64
- func (dto *FullDTO) To() int64
- func (dto *FullDTO) Updated() int64
- func (dto *FullDTO) UserId() string
- type InputGin
- func (h InputGin) Create(c *gin.Context)
- func (h InputGin) CreateByUser(c *gin.Context)
- func (h InputGin) Delete(c *gin.Context)
- func (h InputGin) DeleteAllByUser(c *gin.Context)
- func (h InputGin) DeleteByUser(c *gin.Context)
- func (h InputGin) FetchByUser(c *gin.Context)
- func (h InputGin) Read(c *gin.Context)
- func (h *InputGin) Register(g gin.IRouter, middlewares ...*gin_utils.TorpedoMiddleware)
- func (h InputGin) TQL(c *gin.Context)
- func (h InputGin) Update(c *gin.Context)
- func (h InputGin) UpdateByUser(c *gin.Context)
- type MetadataDTO
- type PartialDTO
- type ReadOnlyDTO
- type RelationshipsDTO
- type UpdatableDTO
- type WriteableDTO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FullDTO ¶
type FullDTO struct { MetadataDTO ReadOnlyDTO WriteableDTO RelationshipsDTO CustomDTO } //@name trip.FullDTO
FullDTO adds the framework fields id, created and updated to complete the schema. Implements trip.IEntityDTO
func FromEntity ¶
func FromEntity(ety *trip.TripEntity) (*FullDTO, error)
type InputGin ¶
type InputGin struct {
// contains filtered or unexported fields
}
InputGin struct to handle the clean integration with Gin Framework
func NewInputGin ¶
NewInputGin input handler constructor
func (InputGin) Create ¶
Create input controller that calls the service create function @Summary create a trip @Schemes http https @Description creates an entity TripEntity @Tags trips @Accept json @Produce json @Param trip body PartialDTO true "The user fly trip reservations" @Success 200 {object} FullDTO @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /trips [post]
func (InputGin) CreateByUser ¶
Create by User input controller that calls the service create function @Summary create a trip @Schemes http https @Description creates an entity TripEntity @Tags trips @Accept json @Produce json @Param trip body PartialDTO true "The user fly trip reservations" @Success 200 {object} FullDTO @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /users/{id}/trips [post]
func (InputGin) Delete ¶
Delete input controller that calls the service delete function @Summary remove a trip @Schemes http https @Description remove an entity TripEntity by Id @Tags trips @Accept json @Produce json @Param id path string true "trip Id" @Success 204 @Failure 404 {object} api.Error @Failure 500 {object} api.Error @Router /trips/{id} [delete]
func (InputGin) DeleteAllByUser ¶
DeleteAllByUser input controller that calls the service delete function @Summary remove all trip given a userId @Schemes http https @Description remove all entity TripEntity by userId @Tags trips @Accept json @Produce json @Param userId path string true "user Id" @Success 204 @Failure 404 {object} api.Error @Failure 500 {object} api.Error @Router /users/{id}/trips [delete]
func (InputGin) DeleteByUser ¶
DeleteByUser input controller that calls the service delete function @Summary remove a trip @Schemes http https @Description remove an entity TripEntity by Id @Tags trips @Accept json @Produce json @Param id path string true "trip Id" @Success 204 @Failure 404 {object} api.Error @Failure 500 {object} api.Error @Router /users/{id}/trips/{tripId} [delete]
func (InputGin) FetchByUser ¶
FetchByUser input controller that calls the service BelongsToUser function @Summary get a trip list @Schemes http https @Description get list of entity TripEntity given a userId @Tags trips @Accept json @Produce json @Param id path string true "userId" @Param page query int false "the pagination page number" @Param items query int false "the amount of items per page" @Success 200 {array} FullDTO @Failure 404 {object} api.Error @Failure 500 {object} api.Error @Router /users/{id}/trips [get]
func (InputGin) Read ¶
Read input controller that calls the service read function @Summary get a trip @Schemes http https @Description get an entity TripEntity by Id @Tags trips @Accept json @Produce json @Param id path string true "trip Id" @Success 200 {object} FullDTO @Failure 404 {object} api.Error @Failure 500 {object} api.Error @Router /trips/{id} [get]
func (*InputGin) Register ¶
func (h *InputGin) Register(g gin.IRouter, middlewares ...*gin_utils.TorpedoMiddleware)
Register adds the urls binding it to service methods in the provided Gin Router
func (InputGin) TQL ¶
TQL Torpedo Query Language input controller that calls the service Query method
func (InputGin) Update ¶
Update input controller that calls the service update function @Summary update a trip @Schemes http https @Description updates an entity TripEntity @Tags trips @Accept json @Produce json @Param id path string true "trip Id" @Param trip body UpdatableDTO true "The user fly trip reservations" @Success 200 {object} FullDTO @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /trips/{id} [put]
func (InputGin) UpdateByUser ¶
Update by User input controller that calls the service update function @Summary update a trip @Schemes http https @Description updates an entity TripEntity @Tags trips @Accept json @Produce json @Param trip body UpdatableDTO true "The user fly trip reservations" @Success 200 {object} FullDTO @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /users/{id}/trips/{tripId} [put]
type MetadataDTO ¶
type MetadataDTO struct { Id_ *string `json:"id"` Created_ *int64 `json:"created"` Updated_ *int64 `json:"updated"` } //@name trip.MetadataDTO
MetadataDTO the metadata fields like id, create and update.
type PartialDTO ¶
type PartialDTO struct { ReadOnlyDTO WriteableDTO CustomDTO } //@name trip.PartialDTO
PartialDTO partial data transfer object schema
type ReadOnlyDTO ¶
type ReadOnlyDTO struct {
} //@name trip.ReadOnlyDTO
ReadOnlyDTO defines the read only fields
type RelationshipsDTO ¶
type RelationshipsDTO struct {
} //@name trip.RelationshipsDTO
type UpdatableDTO ¶
type UpdatableDTO struct { WriteableDTO CustomDTO } //@name trip.UpdatableDTO
UpdatableDTO accept only the writable fields (not read only)
type WriteableDTO ¶
type WriteableDTO struct { Departure_ *string `json:"departure,omitempty"` Arrival_ *string `json:"arrival,omitempty"` Miles_ *int64 `json:"miles,omitempty"` From_ *int64 `json:"from,omitempty"` To_ *int64 `json:"to,omitempty"` UserId_ *string `json:"userId,omitempty"` } //@name trip.WriteableDTO
WriteableDTO defines the writable fields