Deprecated: Please upgrade to the latest major version: go get github.com/go-chi/chi/v5

package v3

import "github.com/go-chi/chi/_examples/versions/presenter/v3"

Index

Variables

var Presenter = render.NewPresenter(CatchAll, ArticleToV3, ArticleChanToV3Chan, ArticleSliceToV3Slice)

Functions

func ArticleChanToV3Chan

func ArticleChanToV3Chan(r *http.Request, fromChan chan *data.Article) (chan *Article, error)

An optional, optimized presenter for channnel of Articles. If not defined, each item will be preseted using ArticleToV3() func.

func CatchAll

func CatchAll(r *http.Request, v interface{}) (*http.Request, interface{})

Types

type Article

type Article struct {
	*data.Article `json:",inline" xml:",inline"`

	// Additional fields.
	URL        string `json:"url" xml:"url"`
	ViewsCount int64  `json:"views_count" xml:"views_count"`
	APIVersion string `json:"api_version" xml:"api_version"`

	// Omitted fields.
	// Show custom_data explicitly for auth'd users only.
	CustomDataForAuthUsers interface{} `json:"custom_data,omitempty" xml:"custom_data,omitempty"`
}

Article presented in API version 2.

func ArticleSliceToV3Slice

func ArticleSliceToV3Slice(r *http.Request, fromSlice []*data.Article) ([]*Article, error)

An optional, optimized presenter for slice of Articles. If not defined, each item will be preseted using ArticleToV3() func.

func ArticleToV3

func ArticleToV3(r *http.Request, from *data.Article) (*Article, error)

Source Files

article.go

Version
v2.0.0+incompatible
Published
Jan 6, 2017
Platform
js/wasm
Imports
8 packages
Last checked
5 days ago

Tools for package owners.