menu

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: 12 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.

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 CreateFromTreeRouter = router.Handler(func(c router.Context) {
	var (
		input []TreeParams
	)

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return CreateFromTree(helper.NewContext(&c), input)
	})
})
View Source
var CreateRouter = router.Handler(func(c router.Context) {
	var (
		input CreateMenuParams
	)

	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("menu_id")

	c.ResponseFunc(nil, func() schema.Response {
		return Delete(helper.NewContext(&c), id)
	})
})
View Source
var GetListRouter = router.Handler(func(c router.Context) {
	var (
		input Query
	)

	c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response {
		return GetList(helper.NewContext(&c), input)
	})
})
View Source
var GetMenuRouter = router.Handler(func(c router.Context) {
	id := c.Param("menu_id")

	c.ResponseFunc(nil, func() schema.Response {
		return GetMenu(helper.NewContext(&c), id)
	})
})
View Source
var UpdateRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateParams
	)

	id := c.Param("menu_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 CreateMenuParams) (res schema.Response)

func CreateFromTree added in v0.3.0

func CreateFromTree(c helper.Context, input []TreeParams) (res schema.Response)

func Delete

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

func DeleteMenuById

func DeleteMenuById(id string)

func GetList

func GetList(c helper.Context, input Query) (res schema.Response)

func GetMenu

func GetMenu(ctx helper.Context, id string) (res schema.Response)

func Update

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

Types

type CreateMenuParams

type CreateMenuParams struct {
	Name      string    `json:"name" validate:"required,max=32" comment:"菜单名"`        // 菜单名
	Url       *string   `json:"url" validate:"omitempty,url,max=255" comment:"菜单地址"`  // 菜单链接的 URL 地址
	Icon      *string   `json:"icon" validate:"omitempty,max=64" comment:"菜单图标"`      // 菜单的图标
	Accession *[]string `json:"accession" validate:"omitempty" comment:"菜单权限"`        // 该菜单所需要的权限
	Sort      *int      `json:"sort" validate:"omitempty,min=1" comment:"菜单排序"`       // 菜单排序, 越大的越靠前
	ParentId  *string   `json:"parent_id" validate:"omitempty,max=32" comment:"父级ID"` // 该菜单的父级 ID
}

type Query

type Query struct {
}

type TreeParams added in v0.3.0

type TreeParams struct {
	CreateMenuParams
	Children []TreeParams `json:"children"`
}

type UpdateParams

type UpdateParams struct {
	Name      *string   `json:"name" validate:"omitempty,max=32" comment:"菜单名"`       // 菜单名
	Url       *string   `json:"url" validate:"omitempty,url,max=255" comment:"菜单地址"`  // 菜单链接的 URL 地址
	Icon      *string   `json:"icon" validate:"omitempty,max=64" comment:"菜单图标"`      // 菜单的图标
	Accession *[]string `json:"accession" validate:"omitempty" comment:"菜单权限"`        // 该菜单所需要的权限
	Sort      *int      `json:"sort" validate:"omitempty,min=1" comment:"菜单排序"`       // 菜单排序, 越大的越靠前
	ParentId  *string   `json:"parent_id" validate:"omitempty,max=32" comment:"父级ID"` // 该菜单的父级 ID
}

Jump to

Keyboard shortcuts

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