v1

package
v0.0.0-...-a413825 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(ctx context.Context, w http.ResponseWriter, err error)

Error sends an error

func FindWhereToEat

func FindWhereToEat(params Params) httprouter.Handle

FindWhereToEat controller to get a random restaurant

func Response

func Response(ctx context.Context, w http.ResponseWriter, result Jsonable)

Response sends a response

Types

type Jsonable

type Jsonable interface {
	ToJSON() (json.RawMessage, error)
}

Jsonable an entity that returns a JSON representation of itself

type Params

type Params struct{}

Params params to enter in controller

type Result

type Result struct {
	Error  *ResultError    `json:"error,omitempty"`
	Result json.RawMessage `json:"result,omitempty"`
}

Result the final result for a given message

type ResultError

type ResultError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ResultError contains the error code and message

Jump to

Keyboard shortcuts

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