controllers

package
v0.0.0-...-a433b9e Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTask

func CreateTask(d models.TaskStore, w http.ResponseWriter, r *http.Request)

func DeleteTask

func DeleteTask(d models.TaskStore, w http.ResponseWriter, r *http.Request)

func GetAllTasks

func GetAllTasks(d models.TaskStore, w http.ResponseWriter, r *http.Request)

gets all tasks for a given user

func GetTask

func GetTask(d models.TaskStore, w http.ResponseWriter, r *http.Request)

Get a specific task for a given user

func GetUser

func GetUser(d *models.DataStore, w http.ResponseWriter, r *http.Request)

func Healthcheck

func Healthcheck(w http.ResponseWriter, r *http.Request)

func Login

Login, attempts to log in a user and writes the response back the ResponseWriter

func Register

func Register(authMod common.Authorizer, d models.UserStore, w http.ResponseWriter, r *http.Request)

Registers a user that includes all the common fields from models.User

func UpdateTask

func UpdateTask(d models.TaskStore, w http.ResponseWriter, r *http.Request)

func WithDb

With db wraps each controller that needs the db with a new session this is important to handle requests concurrently This is only used by the task handlers, which only ever need the TaskStore implementation Going to build this function specifically for that as its then easier to test those functions

func WithDbAndAuth

We will need withAuth module, for register/login routes trying not to populate namespace, so adding another wrapper to deliver db/auth

Types

type CreatedUser

type CreatedUser struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	JWT      string `json:"jwt"`
}

Jump to

Keyboard shortcuts

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