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.
Index ¶
- Variables
- func Create(c helper.Context, input CreateParams) (res schema.Response)
- func Delete(c helper.Context, id string) (res schema.Response)
- func DeleteHelpById(id string)
- func GetHelp(id string) (res schema.Response)
- func GetHelpList(c helper.Context, query Query) (res schema.Response)
- func Update(c helper.Context, helpId string, input UpdateParams) (res schema.Response)
- type CreateParams
- type Query
- type UpdateParams
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateRouter = router.Handler(func(c router.Context) { var ( input CreateParams ) 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("help_id") c.ResponseFunc(nil, func() schema.Response { return Delete(helper.NewContext(&c), id) }) })
View Source
var GetHelpListRouter = router.Handler(func(c router.Context) { var ( query Query ) c.ResponseFunc(c.ShouldBindQuery(&query), func() schema.Response { return GetHelpList(helper.NewContext(&c), query) }) })
View Source
var GetHelpRouter = router.Handler(func(c router.Context) { id := c.Param("help_id") c.ResponseFunc(nil, func() schema.Response { return GetHelp(id) }) })
View Source
var UpdateRouter = router.Handler(func(c router.Context) { var ( input UpdateParams ) id := c.Param("help_id") c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response { return Update(helper.NewContext(&c), id, input) }) })
Functions ¶
func DeleteHelpById ¶
func DeleteHelpById(id string)
Types ¶
type CreateParams ¶
type CreateParams struct { Title string `json:"title" validate:"required,max=32" comment:"标题"` Content string `json:"content" validate:"required" comment:"内容"` Tags []string `json:"tags" validate:"omitempty,max=32" comment:"标签"` Status model.HelpStatus `json:"status" validate:"required" comment:"状态"` Type model.HelpType `json:"type" validate:"required,oneof=article class" comment:"类型"` ParentId *string `json:"parent_id" validate:"omitempty,max=32" comment:"父级ID"` }
type UpdateParams ¶
type UpdateParams struct { Title *string `json:"title" validate:"omitempty,max=32" comment:"标题"` Content *string `json:"content" validate:"omitempty" comment:"内容"` Tags *[]string `json:"tags" validate:"omitempty,max=32" comment:"标签"` Status *model.HelpStatus `json:"status" validate:"omitempty" comment:"状态"` Type *model.HelpType `json:"type" validate:"omitempty,oneof=article class" comment:"类型"` ParentId *string `json:"parent_id" validate:"omitempty,max=32" comment:"父级ID"` }
Click to show internal directories.
Click to hide internal directories.