handler

package
v0.0.0-...-5e74752 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SessionName = "icarus-session"

Variables

View Source
var (
	OK            = M{"okay": true}
	Unauthorized  = M{"error": "unauthorized"}
	Forbidden     = M{"error": "forbidden"}
	NotFound      = M{"error": "not found"}
	InternalError = M{"error": "internal error"}

	BadJSON       = M{"error": "failed to parse JSON"}
	UnknownHandle = M{"error": "unknown handle"}

	BadField = func(field string) M {
		return M{
			"error": fmt.Sprintf("failed to parse field `%s`", field),
		}
	}
	BadMake = func(element string) M {
		return M{
			"error": fmt.Sprintf("failed to make %s", element),
		}
	}
)

Functions

func GetAllTask

func GetAllTask(ctx context.Context) []*task.Task

func GetAllTaskData

func GetAllTaskData(ctx context.Context) []icarus.TaskData

func GetHandle

func GetHandle(ctx context.Context) client.Client

func GetHandleName

func GetHandleName(ctx context.Context) string

func GetJSONKey

func GetJSONKey(ctx context.Context, key string) (json.RawMessage, bool)

func GetJSONKeyAs

func GetJSONKeyAs(ctx context.Context, key string, v interface{}) error

func GetTask

func GetTask(ctx context.Context) *task.Task

func GetTaskID

func GetTaskID(ctx context.Context) int

func GetUser

func GetUser(ctx context.Context) icarus.User

func GetUserData

func GetUserData(ctx context.Context) icarus.UserData

func InitHandler

func InitHandler()

func ParseAllTaskData

func ParseAllTaskData(ctx context.Context, w http.ResponseWriter, r *http.Request) context.Context

func ParseHandle

func ParseHandle(allowEmpty bool) kami.Middleware

After `ParseJSON`

func ParseUser

After `ParseHandle`

func WriteError

func WriteError(w http.ResponseWriter, code int, msg string) error

func WriteJSON

func WriteJSON(w http.ResponseWriter, code int, v interface{}) error

Types

type M

type M map[string]interface{}

Jump to

Keyboard shortcuts

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