news

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 10 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 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 Create

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

func Delete

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

func DeleteNewsById

func DeleteNewsById(id string)

func GetNews

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

func GetNewsList

func GetNewsList(input Query) (res schema.Response)

func Update

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

Types

type CreateNewParams

type CreateNewParams struct {
	Title   string         `json:"title"`
	Content string         `json:"content"`
	Type    model.NewsType `json:"type"`
	Tags    []string       `json:"tags"`
}

type Query

type Query struct {
	schema.Query
	Status *model.NewsStatus `json:"status" form:"status"`
	Type   *model.NewsType   `json:"type" form:"type"`
}

type UpdateParams

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

Jump to

Keyboard shortcuts

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