Documentation ¶
Index ¶
- Constants
- func APIPanicFilter(c *revel.Controller, fc []revel.Filter)
- func CopyImmutableAttributes(source, dest interface{}) error
- func CreateRESTControllerInjectionFilter(authFunction AuthenticationFunction) revel.Filter
- func RegisterRESTControllers(controllers []RESTController)
- type ApiMessage
- type AuthenticationFunction
- type DELETEHooker
- type GETHooker
- type GenericRESTController
- type HookJsonResult
- type ImmutableAttributeCopier
- type POSTHooker
- type PUTHooker
- type RESTController
- type RESTObject
- type User
Constants ¶
View Source
const (
RESTControllerName string = "GenericRESTController"
)
Variables ¶
This section is empty.
Functions ¶
func APIPanicFilter ¶
func APIPanicFilter(c *revel.Controller, fc []revel.Filter)
func CopyImmutableAttributes ¶
func CopyImmutableAttributes(source, dest interface{}) error
func CreateRESTControllerInjectionFilter ¶
func CreateRESTControllerInjectionFilter(authFunction AuthenticationFunction) revel.Filter
func RegisterRESTControllers ¶
func RegisterRESTControllers(controllers []RESTController)
Register the RESTControllers
Types ¶
type ApiMessage ¶
A revel.Result renderable object used to convey a status code and error message
func DefaultBadRequestMessage ¶
func DefaultBadRequestMessage() ApiMessage
func DefaultInternalServerErrorMessage ¶
func DefaultInternalServerErrorMessage() ApiMessage
func DefaultNotFoundMessage ¶
func DefaultNotFoundMessage() ApiMessage
type AuthenticationFunction ¶
type DELETEHooker ¶
type DELETEHooker interface { RESTController PreDELETEHook(model RESTObject, authUser User) revel.Result PostDELETEHook(model RESTObject, authUser User, err error) revel.Result }
type GETHooker ¶
type GETHooker interface { RESTController PreGETHook(id uint64, authUser User) revel.Result PostGETHook(model RESTObject, authUser User) revel.Result }
type GenericRESTController ¶
type GenericRESTController struct { Request *revel.Request // contains filtered or unexported fields }
func (*GenericRESTController) Delete ¶
func (c *GenericRESTController) Delete(id uint64) revel.Result
func (*GenericRESTController) Post ¶
func (c *GenericRESTController) Post() revel.Result
func (*GenericRESTController) Put ¶
func (c *GenericRESTController) Put() revel.Result
type HookJsonResult ¶
type HookJsonResult struct {
Body interface{}
}
Result that can be returned from a hook
type ImmutableAttributeCopier ¶
type ImmutableAttributeCopier interface { RESTObject CopyImmutableAttributesTo(dest interface{}) error }
Copies attributes that should be immutable from the source RESTObject to the dest RESTObject
type POSTHooker ¶
type POSTHooker interface { RESTController PrePOSTHook(model RESTObject, authUser User) revel.Result PostPOSTHook(model RESTObject, authUser User, err error) revel.Result }
type PUTHooker ¶
type PUTHooker interface { RESTController PrePUTHook(newInstance, existingInstance RESTObject, authUser User) revel.Result PostPUTHook(newInstance, existingInstance RESTObject, authUser User, err error) revel.Result }
type RESTController ¶
type RESTController interface { ModelFactory() RESTObject GetModelByID(id uint64) RESTObject EnableGET() bool EnablePOST() bool EnablePUT() bool EnableDELETE() bool }
A Controller that concerns itself with managing one type of RESTObject
type RESTObject ¶
type RESTObject interface { UniqueID() uint64 CanBeViewedBy(user User) bool CanBeCreatedBy(user User) bool CanBeModifiedBy(user User) bool CanBeDeletedBy(user User) bool Validate(v *revel.Validation) Delete() error Save() error }
A server-side data model that can be served by RESTControllers
type User ¶
type User interface { RESTObject HasAdminPrivileges() bool }
A RESTObject that can be authenticated by RESTControllers
Source Files ¶
Click to show internal directories.
Click to hide internal directories.