help

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 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, query 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" 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 Query

type Query struct {
	schema.Query
	Status *model.HelpStatus `json:"status" url:"status" validate:"omitempty,number" comment:"状态"` // 根据状态筛选
	Type   *model.HelpType   `json:"type" url:"type" validate:"omitempty" comment:"类型"`            // 根据类型筛选
}

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"`
}

Jump to

Keyboard shortcuts

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