controllers

package
v0.0.0-...-86643de Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: BSD-2-Clause Imports: 1 Imported by: 2

Documentation

Overview

The controllers package provides interfaces that should be utilised when building RESTful controller objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterHandler

type AfterHandler interface {

	// After is called after any other mapped methods.
	After(context.Context) error
}

AfterHandler represents a controller that has an after handler.

After handlers will be mapped to any actions of this controller and will be called after any of the main methods.

type BeforeHandler

type BeforeHandler interface {

	// Before is called after any other mapped methods.
	Before(context.Context) error
}

BeforeHandler represents a controller that has a before handler.

Before handlers will be mapped to any actions of this controller and will be called before any of the main methods.

type RestfulController

type RestfulController interface {
	// Path gets the path prefix for this controller.
	Path() string
}

RestfulController represents an object that satisfies key aspects of a RESTful controller.

type RestfulCreator

type RestfulCreator interface {
	// Create creates a new resource, or new resources.
	Create(ctx context.Context) error
}

RestfulCreator represents a controller capable of creating RESTful resources.

This is usually mapped to the following kind of request:

POST /resources

type RestfulDeletor

type RestfulDeletor interface {
	// Delete delets a single resource.
	Delete(id string, ctx context.Context) error
}

RestfulDeletor represents a controller capable of deleting a single resource.

This is usually mapped to the following kind of request:

DELETE /resources/{id}

type RestfulHead

type RestfulHead interface {
	// Head gets the headers only for the request.
	Head(ctx context.Context) error
}

RestfulHead represents a controller that explicitly handles a HEAD request.

This is usually mapped to the following kind of requests:

HEAD /resources
HEAD /resources/{id}

type RestfulManyDeleter

type RestfulManyDeleter interface {
	// DeleteMany deletes many resources.
	DeleteMany(ctx context.Context) error
}

RestfulManyDeleter represents a controller capable of deleting many resources.

This is usually mapped to the following kind of request:

DELETE /resources

type RestfulManyReader

type RestfulManyReader interface {
	// ReadMany reads many resources.
	ReadMany(ctx context.Context) error
}

RestfulManyReader represents a controller capable of reading many resources.

This is usually mapped to the following kind of request:

GET /resources

type RestfulManyUpdater

type RestfulManyUpdater interface {
	// UpdateMany updates many resources at once.
	UpdateMany(ctx context.Context) error
}

RestfulManyUpdater represents a controller capable of updating many resources.

This is usually mapped to the following kind of request:

PATCH /resources

type RestfulOptions

type RestfulOptions interface {
	// Options returns valid options for this resource.
	Options(ctx context.Context) error
}

RestfulOptions represents a controller that explicitly handles an OPTIONS request.

This is usually mapped to the following kind of requests:

OPTIONS /resources
OPTIONS /resources/{id}

type RestfulReader

type RestfulReader interface {
	// Read reads a single resource.
	Read(id string, ctx context.Context) error
}

RestfulReader represents a controller capable of reading a single resource.

This is usually mapped to the following kind of request:

GET /resources/{id}

type RestfulReplacer

type RestfulReplacer interface {
	// Replace replaces a single resource.
	Replace(id string, ctx context.Context) error
}

RestfulReplacer represents a controller capable of replacing a single resource.

This is usually mapped to the following kind of request:

PUT /resources/{id}

type RestfulUpdater

type RestfulUpdater interface {
	// Update updates a single resource.
	Update(id string, ctx context.Context) error
}

RestfulUpdater represents a controller capable of updating a single resource.

This is usually mapped to the following kind of request:

PATCH /resources/{id}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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