api

package
v0.0.0-...-fa8c592 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Repo *repo.Repo
	Nsq  *workers.NSQ
}

func (*API) AddView

func (api *API) AddView(w http.ResponseWriter, r *http.Request)

AddView adds new view to article statistics * * POST /counter/v1/statistics

func (*API) CreateArticle

func (api *API) CreateArticle(w http.ResponseWriter, r *http.Request)

CreateArticle creates new article * * POST /counter/v1/article/add

func (*API) GetArticle

func (api *API) GetArticle(w http.ResponseWriter, r *http.Request)

GetArticle fetchs article

* GET /counter/v1/statistics/article_id/:id

func (*API) Index

func (api *API) Index(w http.ResponseWriter, r *http.Request)

* * POST /v1/counter

func (*API) PublishNSQMes

func (api *API) PublishNSQMes(topic string, mes []byte)

type Attributes

type Attributes struct {
	Views []*model.ArticleView `bson:"count" json:"count" valid:"required"`
}

type Data

type Data struct {
	ID             string      `bson:"article_id" json:"article_id" valid:"required"`
	Type           string      `bson:"type" json:"type" valid:"required"`
	DataAttributes *Attributes `bson:"attributes" json:"attributes" valid:"required"`
}

type StaticsResponse

type StaticsResponse struct {
	Result *Data `bson:"data" json:"data" valid:"required"`
}

Jump to

Keyboard shortcuts

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