help

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 11 Imported by: 0

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

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 Create

func Create(c helper.Context, input CreateParams) (res schema.Response)

func Delete

func Delete(c helper.Context, id string) (res schema.Response)

func DeleteHelpById

func DeleteHelpById(id string)

func GetHelp

func GetHelp(id string) (res schema.Response)

func GetHelpList

func GetHelpList(c helper.Context, q Query) (res schema.Response)

func Update

func Update(c helper.Context, helpId string, input UpdateParams) (res schema.Response)

Types

type CreateParams

type CreateParams struct {
	Title    string           `json:"title" valid:"required~请填写标题"`
	Content  string           `json:"content" valid:"required~请填写内容"`
	Tags     []string         `json:"tags"`
	Status   model.HelpStatus `json:"status" valid:"required~请填写状态"`
	Type     model.HelpType   `json:"type" valid:"required~请填写类型"`
	ParentId *string          `json:"parent_id"`
}

type Query

type Query struct {
	schema.Query
	Status *model.HelpStatus `json:"status" form:"status"` // 根据状态筛选
	Type   *model.HelpType   `json:"type" form:"type"`     // 根据类型筛选
}

type UpdateParams

type UpdateParams struct {
	Title    *string           `json:"title"`
	Content  *string           `json:"content"`
	Tags     *[]string         `json:"tags"`
	Status   *model.HelpStatus `json:"status"`
	Type     *model.HelpType   `json:"type"`
	ParentId *string           `json:"parent_id"`
}

Jump to

Keyboard shortcuts

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