controllers

package
v0.0.0-...-674016c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVersion

func GetVersion(c *gin.Context)

Types

type Article

type Article struct {
}

func (*Article) Create

func (controller *Article) Create(c *gin.Context)

@Summary Create a new Article @Description Crete a new Article based on json data @Accept json @Produce json @Tags Article @Param message body controllers.CreateArticleInput true "Article" @success 200 {object} controllers.JSONResult{data=models.Article} "desc" @Router /api/v1/article [post]

func (*Article) Delete

func (controller *Article) Delete(c *gin.Context)

@Summary Deletes a Article @Description Removes a Article from DB @Accept json @Produce json @Tags Article @Param some_id path int true "ArticleID" @success 200 {object} controllers.JSONResult{data=controllers.Deleted} "desc" @Router /api/v1/article/{id} [delete]

func (*Article) Get

func (controller *Article) Get(c *gin.Context)

@Summary Show an Article @Description get Article by ID @Accept json @Produce json @Tags Article @Param id path int true "Article ID" @success 200 {object} controllers.JSONResult{data=models.Article} "desc" @Router /api/v1/article/{id} [get]

func (*Article) List

func (controller *Article) List(c *gin.Context)

@Summary Lists all Articles @Description Lists all Articles @Security ApiKeyAuth @Accept json @Produce json @Tags Article @Success 200 {string} []models.Article @success 200 {object} controllers.JSONResult{data=[]models.Article} "desc" @Router /api/v1/articles [get]

func (*Article) Update

func (controller *Article) Update(c *gin.Context)

@Summary Update a Article @Description updates a Article by id @Accept json @Produce json @Tags Article @Param some_id path int true "ArticleID" @Param message body controllers.CreateArticleInput true "Article" @success 200 {object} controllers.JSONResult{data=models.Article} "desc" @Router /api/v1/article/{id} [put]

type CreateArticleInput

type CreateArticleInput struct {
	Title string `json:"title" binding:"required"`
	Body  string `json:"body"`
}

type Deleted

type Deleted string

type JSONResult

type JSONResult struct {
	Data interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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