gin

package
v0.0.0-...-f52bcce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package gin input

Package gin input

Package gin input

Package gin input

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomDTO

type CustomDTO struct {

} //@name trip.CustomDTO

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)

func NewFullDTO

func NewFullDTO() *FullDTO

NewFullDTO full DTO constructor

func (*FullDTO) Arrival

func (dto *FullDTO) Arrival() string

Arrival getter method

func (*FullDTO) Created

func (dto *FullDTO) Created() int64

Created getter method

func (*FullDTO) Departure

func (dto *FullDTO) Departure() string

Departure getter method

func (*FullDTO) From

func (dto *FullDTO) From() int64

From getter method

func (*FullDTO) Id

func (dto *FullDTO) Id() string

Id getter method

func (*FullDTO) Miles

func (dto *FullDTO) Miles() int64

Miles getter method

func (*FullDTO) To

func (dto *FullDTO) To() int64

To getter method

func (*FullDTO) Updated

func (dto *FullDTO) Updated() int64

Updated getter method

func (*FullDTO) UserId

func (dto *FullDTO) UserId() string

UserId getter method

type InputGin

type InputGin struct {
	// contains filtered or unexported fields
}

InputGin struct to handle the clean integration with Gin Framework

func NewInputGin

func NewInputGin(service trip.IService, logger log.ILogger) *InputGin

NewInputGin input handler constructor

func (InputGin) Create

func (h InputGin) Create(c *gin.Context)

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

func (h InputGin) CreateByUser(c *gin.Context)

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

func (h InputGin) Delete(c *gin.Context)

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

func (h InputGin) DeleteAllByUser(c *gin.Context)

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

func (h InputGin) DeleteByUser(c *gin.Context)

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

func (h InputGin) FetchByUser(c *gin.Context)

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

func (h InputGin) Read(c *gin.Context)

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

func (h InputGin) TQL(c *gin.Context)

TQL Torpedo Query Language input controller that calls the service Query method

func (InputGin) Update

func (h InputGin) Update(c *gin.Context)

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

func (h InputGin) UpdateByUser(c *gin.Context)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL