api

package
v0.0.0-...-6475e20 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_PAGE  = 1
	DEFAULT_LIMIT = 50
)

Variables

This section is empty.

Functions

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, v any) error

Types

type ArticleHandler

type ArticleHandler struct {
	// contains filtered or unexported fields
}

func NewArticleHandler

func NewArticleHandler(store store.ArticleStorer) *ArticleHandler

func (*ArticleHandler) HandleGetArticle

func (h *ArticleHandler) HandleGetArticle(w http.ResponseWriter, r *http.Request) error

func (*ArticleHandler) HandleGetArticles

func (h *ArticleHandler) HandleGetArticles(w http.ResponseWriter, r *http.Request) error

func (*ArticleHandler) HandlePostArticle

func (h *ArticleHandler) HandlePostArticle(w http.ResponseWriter, r *http.Request) error

type Error

type Error struct {
	Status int    `json:"status"`
	Err    string `json:"err"`
}

func ErrBadRequest

func ErrBadRequest() Error

func ErrInternalServerError

func ErrInternalServerError() Error

func ErrNoDocuments

func ErrNoDocuments() Error

func NewError

func NewError(status int, err string) Error

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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