users

package
v0.0.0-...-c950848 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes(r chi.Router, db *pg.DB) chi.Router

Routes consists of the route method declarations for Users.

Types

type Handler

type Handler core.Handler

Handler consists of the DB connection and Routes

func (*Handler) Delete

func (cw *Handler) Delete(w http.ResponseWriter, r *http.Request)

Delete handler deletes a user by the provided {userId}

func (*Handler) Get

func (cw *Handler) Get(w http.ResponseWriter, r *http.Request)

Get handler returns a user by the provided {userId}

func (*Handler) List

func (cw *Handler) List(w http.ResponseWriter, r *http.Request)

List handler returns all users in JSON format.

func (*Handler) Store

func (cw *Handler) Store(w http.ResponseWriter, r *http.Request)

Store handler creates a new user and returns the user in JSON format.

func (*Handler) Update

func (cw *Handler) Update(w http.ResponseWriter, r *http.Request)

Update handler updates a user by the provided {userId}

func (*Handler) UserCtx

func (cw *Handler) UserCtx(next http.Handler) http.Handler

UserCtx handler loads a user by either {userId} or {userSlug}

type UserRequest

type UserRequest struct {
	*models.User
}

UserRequest is a pointer to the User model.

func (*UserRequest) Bind

func (u *UserRequest) Bind(r *http.Request) error

Bind validates the UserRequest body for required fields.

Jump to

Keyboard shortcuts

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