domain

package
v0.0.0-...-a85dc47 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2016 License: MIT Imports: 5 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLHandlerFunc

type ACLHandlerFunc func(*http.Request, IUser) (bool, string)

type ACLMap

type ACLMap map[string]ACLHandlerFunc

func (*ACLMap) Append

func (m *ACLMap) Append(maps ...*ACLMap) ACLMap

type AcceptHeader

type AcceptHeader struct {
	MediaType     MediaType `json:"media_type"`
	QualityFactor float64   `json:"quality_factor"`
}

type AcceptHeaders

type AcceptHeaders []AcceptHeader

func NewAcceptHeadersFromString

func NewAcceptHeadersFromString(str string) AcceptHeaders

type Change

type Change mgo.Change

type ContextHandlerFunc

type ContextHandlerFunc func(http.ResponseWriter, *http.Request, IContext)

func (ContextHandlerFunc) ServeHTTP

func (h ContextHandlerFunc) ServeHTTP(rw http.ResponseWriter, r *http.Request, ctx IContext)

type ContextKey

type ContextKey string

type ContextMiddlewareFunc

type ContextMiddlewareFunc func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc, ctx IContext)

func (ContextMiddlewareFunc) ServeHTTP

type ControllerHook

type ControllerHook func(w http.ResponseWriter, req *http.Request, ctx IContext, payload interface{}) error

type IAccessController

type IAccessController interface {
	Add(*ACLMap)
	AddHandler(name string, handler ACLHandlerFunc)
	HasAction(string) bool
	IsHTTPRequestAuthorized(req *http.Request, ctx IContext, action string, user IUser) (bool, string)
	NewContextHandler(string, http.HandlerFunc) http.HandlerFunc
}

type IContext

type IContext interface {
	Set(r *http.Request, key interface{}, val interface{})
	Get(r *http.Request, key interface{}) interface{}

	SetCurrentUserCtx(r *http.Request, user IUser)
	GetCurrentUserCtx(r *http.Request) IUser

	InjectMiddleware(ContextMiddlewareFunc) MiddlewareFunc
	Inject(handler ContextHandlerFunc) http.HandlerFunc
}

type IContextMiddleware

type IContextMiddleware interface {
	Handler(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc, ctx IContext)
}

type IDatabase

type IDatabase interface {
	Insert(name string, obj interface{}) error
	Update(name string, query Query, change Change, result interface{}) error
	UpdateAll(name string, query Query, change Query) (int, error)
	FindOne(name string, query Query, result interface{}) error
	FindAll(name string, query Query, result interface{}, limit int, sort string) error
	Count(name string, query Query) (int, error)
	RemoveOne(name string, query Query) error
	RemoveAll(name string, query Query) error
	Exists(name string, query Query) bool
	DropCollection(name string) error
	DropDatabase() error
	EnsureIndex(name string, index mgo.Index) error
}

Database interface

type IMiddleware

type IMiddleware interface {
	Handler(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
}

type IRenderer

type IRenderer interface {
	Render(w http.ResponseWriter, req *http.Request, status int, v interface{})
	JSON(w http.ResponseWriter, status int, v interface{})
	XML(w http.ResponseWriter, status int, v interface{})
	Data(w http.ResponseWriter, status int, v []byte)
	Text(w http.ResponseWriter, status int, v []byte)
}

Renderer interface

type IResource

type IResource interface {
	Context() IContext
	Routes() *Routes
	Render(w http.ResponseWriter, req *http.Request, status int, v interface{})
}

type IRole

type IRole interface{}

type IRoles

type IRoles []IRole

type IUser

type IUser interface {
	GetID() string
	IsValid() bool
	IsCodeVerified(code string) bool
	IsCredentialsVerified(password string) bool
	SetPassword(password string) error
	GenerateConfirmationCode()
	HasRole(r IRole) bool
}

type IUsers

type IUsers interface{}

type Index

type Index mgo.Index

type MediaType

type MediaType struct {
	String     string          `json:"string"`
	Type       string          `json:"type"`
	Tree       string          `json:"tree"`
	SubType    string          `json:"subtype"`
	Suffix     string          `json:"suffix"`
	Parameters MediaTypeParams `json:"parameters"`
}

type MediaTypeParams

type MediaTypeParams map[string]string

type MiddlewareFunc

type MiddlewareFunc func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (MiddlewareFunc) ServeHTTP

func (m MiddlewareFunc) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type Query

type Query map[string]interface{}

type Route

type Route struct {
	Name           string
	Method         string
	Pattern        string
	DefaultVersion RouteHandlerVersion
	RouteHandlers  RouteHandlers
	ACLHandler     ACLHandlerFunc
}

Route type Note that DefaultVersion must exists in RouteHandlers map See routes.go for examples

type RouteHandlerVersion

type RouteHandlerVersion string

RouteHandlerVersion type

type RouteHandlers

type RouteHandlers map[RouteHandlerVersion]http.HandlerFunc

RouteHandlers is a map of route version to its handler

type Routes

type Routes []Route

Routes type

func (*Routes) Append

func (r *Routes) Append(routes ...*Routes) Routes

Append Returns a new slice of Routes

Jump to

Keyboard shortcuts

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