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: 13 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 user.CustomDTO

type FullDTO

type FullDTO struct {
	MetadataDTO
	ReadOnlyDTO
	WriteableDTO
	RelationshipsDTO
	CustomDTO

} //@name user.FullDTO

FullDTO adds the framework fields id, created and updated to complete the schema. Implements user.IEntityDTO

func FromEntity

func FromEntity(ety *user.UserEntity) (*FullDTO, error)

func NewFullDTO

func NewFullDTO() *FullDTO

NewFullDTO full DTO constructor

func (*FullDTO) Created

func (dto *FullDTO) Created() int64

Created getter method

func (*FullDTO) Email

func (dto *FullDTO) Email() string

Email 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) Name

func (dto *FullDTO) Name() string

Name getter method

func (*FullDTO) Password

func (dto *FullDTO) Password() string

Password getter method

func (*FullDTO) Plan

func (dto *FullDTO) Plan() string

Plan getter method

func (*FullDTO) Updated

func (dto *FullDTO) Updated() int64

Updated 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 user.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 user @Schemes http https @Description creates an entity UserEntity @Tags users @Accept json @Produce json @Param user body PartialDTO true "The user system" @Success 200 {object} FullDTO @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /users [post]

func (InputGin) Delete

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

Delete input controller that calls the service delete function @Summary remove a user @Schemes http https @Description remove an entity UserEntity by Id @Tags users @Accept json @Produce json @Param id path string true "user Id" @Success 204 @Failure 404 {object} api.Error @Failure 500 {object} api.Error @Router /users/{id} [delete]

func (InputGin) Read

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

Read input controller that calls the service read function @Summary get a user @Schemes http https @Description get an entity UserEntity by Id @Tags users @Accept json @Produce json @Param id path string true "user Id" @Success 200 {object} FullDTO @Failure 404 {object} api.Error @Failure 500 {object} api.Error @Router /users/{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 user @Schemes http https @Description updates an entity UserEntity @Tags users @Accept json @Produce json @Param id path string true "user Id" @Param user body UpdatableDTO true "The user system" @Success 200 {object} FullDTO @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /users/{id} [put]

type MetadataDTO

type MetadataDTO struct {
	Id_      *string `json:"id"`
	Created_ *int64  `json:"created"`
	Updated_ *int64  `json:"updated"`

} //@name user.MetadataDTO

MetadataDTO the metadata fields like id, create and update.

type PartialDTO

type PartialDTO struct {
	ReadOnlyDTO
	WriteableDTO
	CustomDTO

} //@name user.PartialDTO

PartialDTO partial data transfer object schema

type ReadOnlyDTO

type ReadOnlyDTO struct {

} //@name user.ReadOnlyDTO

ReadOnlyDTO defines the read only fields

type RelationshipsDTO

type RelationshipsDTO struct {
	Trips_ []tripHTTP.FullDTO `json:"trips,omitempty"`

} //@name user.RelationshipsDTO

type UpdatableDTO

type UpdatableDTO struct {
	WriteableDTO
	CustomDTO

} //@name user.UpdatableDTO

UpdatableDTO accept only the writable fields (not read only)

type WriteableDTO

type WriteableDTO struct {
	Name_     *string `json:"name,omitempty"`
	Email_    *string `json:"email,omitempty"`
	Password_ *string `json:"password,omitempty"`
	Plan_     *string `json:"plan,omitempty"`
	Miles_    *int64  `json:"miles,omitempty"`

} //@name user.WriteableDTO

WriteableDTO defines the writable fields

Jump to

Keyboard shortcuts

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