Documentation ¶
Overview ¶
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Index ¶
- Variables
- func Create(c helper.Context, input CreateNewParams) (res schema.Response)
- func Delete(c helper.Context, addressId string) (res schema.Response)
- func DeleteNewsById(id string)
- func GetNews(id string) (res schema.Response)
- func GetNewsList(query Query) (res schema.Response)
- func Update(c helper.Context, newsId string, input UpdateParams) (res schema.Response)
- type CreateNewParams
- type Query
- type UpdateParams
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateRouter = router.Handler(func(c router.Context) { var ( input CreateNewParams ) c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return Create(helper.NewContext(&c), input) }) })
View Source
var DeleteRouter = router.Handler(func(c router.Context) { id := c.Param("news_id") c.ResponseFunc(nil, func() schema.Response { return Delete(helper.NewContext(&c), id) }) })
View Source
var GetNewsListRouter = router.Handler(func(c router.Context) { var ( input Query ) c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response { return GetNewsList(input) }) })
View Source
var GetNewsRouter = router.Handler(func(c router.Context) { id := c.Param("news_id") c.ResponseFunc(nil, func() schema.Response { return GetNews(id) }) })
View Source
var UpdateRouter = router.Handler(func(c router.Context) { var ( input UpdateParams ) c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return Update(helper.NewContext(&c), c.Param("news_id"), input) }) })
Functions ¶
func DeleteNewsById ¶
func DeleteNewsById(id string)
func GetNewsList ¶
Types ¶
type CreateNewParams ¶
type CreateNewParams struct { Title string `json:"title" validate:"required,max=32" comment:"标题"` Content string `json:"content" validate:"required" comment:"内容"` Type model.NewsType `json:"type" validate:"required,max=32" comment:"类型"` Tags []string `json:"tags" validate:"omitempty" comment:"标题"` }
type UpdateParams ¶
type UpdateParams struct { Title *string `json:"title" validate:"omitempty,max=32" comment:"标题"` Content *string `json:"content" validate:"omitempty" comment:"内容"` Type *model.NewsType `json:"type" validate:"omitempty,max=32" comment:"类型"` Tags *[]string `json:"tags" validate:"omitempty" comment:"标题"` Status *model.NewsStatus `json:"status" validate:"omitempty" comment:"状态"` }
Click to show internal directories.
Click to hide internal directories.