realworld

package
v0.0.0-...-973ca76 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 17 Imported by: 0

README

Libraries

Documentation

Index

Constants

This section is empty.

Variables

Functions

func GetLogger

func GetLogger(ctx context.Context) *logrus.Entry

func NewLogger

func NewLogger() *logrus.Logger

func NewRouter

func NewRouter(logger *logrus.Logger, userHandler UserHandler) *mux.Router

func WithLogger

func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context

Types

type Env

type Env struct {
	Host string `envconfig:"host" default:"127.0.0.1"`
	Port int    `envconfig:"port" default:"8080"`
}

func NewEnv

func NewEnv() (Env, error)

type HTTPServer

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

func InjectHTTPServer

func InjectHTTPServer() (HTTPServer, error)

func NewHTTPServer

func NewHTTPServer(logger *logrus.Logger, env Env, router *mux.Router) HTTPServer

func (HTTPServer) Run

func (s HTTPServer) Run()

type User

type User struct {
	Id int `json:"id" validate:"gte=1,lte=1000"`
}

type UserHandler

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

func NewUserHandler

func NewUserHandler(validator Validator) UserHandler

func (UserHandler) GetUser

func (h UserHandler) GetUser(w http.ResponseWriter, r *http.Request)

type UserRequest

type UserRequest struct {
	User
}

type Validator

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

func NewValidator

func NewValidator() (Validator, error)

func (*Validator) Validate

func (v *Validator) Validate(req interface{}) (map[string]string, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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