Documentation ¶
Index ¶
- func AnonStack() middleware.Stack
- func AuthStack() middleware.Stack
- func CheckAccessRight(collection, field string, optional bool, factory func() appbackend.UserObject) middleware.Middleware
- func CountEndpoint(collection string, paramFactory func() interface{}, ...) httprouter.Handle
- func CreateDBSession(fn httprouter.Handle) httprouter.Handle
- func DecodeJSON(fnObject func() interface{}) func(fn httprouter.Handle) httprouter.Handle
- func DecodeQuery(fnObject func() interface{}) func(fn httprouter.Handle) httprouter.Handle
- func Filter(filterFn FilterFn) middleware.Middleware
- func FilterID(fn httprouter.Handle) httprouter.Handle
- func FilterUserID(fn httprouter.Handle) httprouter.Handle
- func InsertEndpoint(collection string, factory Factory, pre []middleware.Middleware, ...) httprouter.Handle
- func InsertObject(collection string) middleware.Middleware
- func JwtToken(fn httprouter.Handle) httprouter.Handle
- func ObjectIDRequired(fn httprouter.Handle) httprouter.Handle
- func OptionalAuthStack() middleware.Stack
- func OutputOK(w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func OutputObjectID(w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func OutputResult(name string) httprouter.Handle
- func OutputSelectOneResult() httprouter.Handle
- func OutputSelectResult(collection string) httprouter.Handle
- func PublishInsert(collection string) middleware.Middleware
- func SelectCacheResult(cacheKeyFn CacheKeyFn) func(fn httprouter.Handle) httprouter.Handle
- func SelectEndpoint(collection string, factory func() interface{}, paramFactory func() interface{}, ...) httprouter.Handle
- func SelectOneEndpoint(collection string, factory func() interface{}, paramFactory func() interface{}, ...) httprouter.Handle
- func SelectOneQuery(factory func() interface{}) func(fn httprouter.Handle) httprouter.Handle
- func SelectQuery(factory func() interface{}) func(fn httprouter.Handle) httprouter.Handle
- func Selector(selectorFn SelectorFn) middleware.Middleware
- func SetUserID(fn httprouter.Handle) httprouter.Handle
- func UpdateEndpoint(collection string, factory func() interface{}, pre []middleware.Middleware, ...) httprouter.Handle
- func UpdateObject(collection string) func(fn httprouter.Handle) httprouter.Handle
- func UserIDRequired(fn httprouter.Handle) httprouter.Handle
- type CacheKeyContextKey
- type CacheKeyFn
- type Count
- type CountEndpointBuilder
- type DBEndpointBuilder
- type Endpoint
- type Factory
- type FilterFn
- type InsertEndpointBuilder
- type InsertMessage
- type InsertedIDContextKey
- type JwtClaimsContextKey
- type ObjectContextKey
- type QueryObjectContextKey
- type SelectEndpointBuilder
- type SelectParams
- type SelectParamsOffsetLimit
- type SelectResultContextKey
- type SelectorContextKey
- type SelectorFn
- type SessContextKey
- type UpdateEndpointBuilder
- type UpdatedIDContextKey
- type UserIDContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAccessRight ¶
func CheckAccessRight(collection, field string, optional bool, factory func() appbackend.UserObject) middleware.Middleware
CheckAccessRight - checks if the user has access to the given object
func CountEndpoint ¶
func CountEndpoint( collection string, paramFactory func() interface{}, pre []middleware.Middleware, post []middleware.Middleware, ) httprouter.Handle
CountEndpoint - select objects
func CreateDBSession ¶
func CreateDBSession(fn httprouter.Handle) httprouter.Handle
CreateDBSession - Creates a DB session and stores it in the context
func DecodeJSON ¶
func DecodeJSON(fnObject func() interface{}) func(fn httprouter.Handle) httprouter.Handle
DecodeJSON - decodes the JSON payload
func DecodeQuery ¶
func DecodeQuery(fnObject func() interface{}) func(fn httprouter.Handle) httprouter.Handle
DecodeQuery - decodes the query payload
func Filter ¶
func Filter(filterFn FilterFn) middleware.Middleware
func FilterID ¶
func FilterID(fn httprouter.Handle) httprouter.Handle
func FilterUserID ¶
func FilterUserID(fn httprouter.Handle) httprouter.Handle
func InsertEndpoint ¶
func InsertEndpoint( collection string, factory Factory, pre []middleware.Middleware, post []middleware.Middleware, ) httprouter.Handle
InsertEndpoint - insert an object
func InsertObject ¶
func InsertObject(collection string) middleware.Middleware
InsertObject - Insert the payload object to DB
func JwtToken ¶
func JwtToken(fn httprouter.Handle) httprouter.Handle
JwtToken - decodes the JWT token for the request
func ObjectIDRequired ¶
func ObjectIDRequired(fn httprouter.Handle) httprouter.Handle
ObjectIDRequired - Checks if the object's id is set in the payload
func OptionalAuthStack ¶
func OptionalAuthStack() middleware.Stack
OptionalAuthStack - Decodes JWT token, errors on failure
func OutputOK ¶
func OutputOK(w http.ResponseWriter, r *http.Request, p httprouter.Params)
OutputOK - returns the OK response
func OutputObjectID ¶
func OutputObjectID(w http.ResponseWriter, r *http.Request, p httprouter.Params)
OutputObjectID - returns the inserted object ID
func OutputResult ¶
func OutputResult(name string) httprouter.Handle
func OutputSelectOneResult ¶
func OutputSelectOneResult() httprouter.Handle
OutputSelectOneResult - returns the data
func OutputSelectResult ¶
func OutputSelectResult(collection string) httprouter.Handle
OutputSelectResult - returns the list of data
func PublishInsert ¶
func PublishInsert(collection string) middleware.Middleware
func SelectCacheResult ¶
func SelectCacheResult(cacheKeyFn CacheKeyFn) func(fn httprouter.Handle) httprouter.Handle
func SelectEndpoint ¶
func SelectEndpoint( collection string, factory func() interface{}, paramFactory func() interface{}, pre []middleware.Middleware, post []middleware.Middleware, ) httprouter.Handle
SelectEndpoint - select objects
func SelectOneEndpoint ¶
func SelectOneEndpoint( collection string, factory func() interface{}, paramFactory func() interface{}, pre []middleware.Middleware, post []middleware.Middleware, ) httprouter.Handle
SelectOneEndpoint - select object
func SelectOneQuery ¶
func SelectOneQuery(factory func() interface{}) func(fn httprouter.Handle) httprouter.Handle
func SelectQuery ¶
func SelectQuery(factory func() interface{}) func(fn httprouter.Handle) httprouter.Handle
func Selector ¶
func Selector(selectorFn SelectorFn) middleware.Middleware
func SetUserID ¶
func SetUserID(fn httprouter.Handle) httprouter.Handle
SetUserID - sets the userID field for the object payload
func UpdateEndpoint ¶
func UpdateEndpoint( collection string, factory func() interface{}, pre []middleware.Middleware, post []middleware.Middleware, ) httprouter.Handle
UpdateEndpoint - updates and object
func UpdateObject ¶
func UpdateObject(collection string) func(fn httprouter.Handle) httprouter.Handle
UpdateObject - Updates the db object with JSON payload object
func UserIDRequired ¶
func UserIDRequired(fn httprouter.Handle) httprouter.Handle
UserIDRequired - Checks if the request has a userID
Types ¶
type CacheKeyContextKey ¶
type CacheKeyContextKey struct{}
type CacheKeyFn ¶
type CacheKeyFn func(r *http.Request, p httprouter.Params) string
type CountEndpointBuilder ¶
type CountEndpointBuilder struct { DBEndpointBuilder Selector middleware.Middleware Collection string }
func NewCountEndpointBuilder ¶
func NewCountEndpointBuilder(collection string, param Factory, pre, post []middleware.Middleware) CountEndpointBuilder
func (CountEndpointBuilder) Endpoint ¶
func (dbe CountEndpointBuilder) Endpoint() Endpoint
type DBEndpointBuilder ¶
type DBEndpointBuilder struct { Params middleware.Middleware Input middleware.Middleware Pre []middleware.Middleware DBFn middleware.Middleware Post []middleware.Middleware Output httprouter.Handle }
func NewDBEndpointBuilder ¶
func NewDBEndpointBuilder(param Factory, input Factory, pre, post []middleware.Middleware, dbfn middleware.Middleware, output httprouter.Handle) DBEndpointBuilder
func (DBEndpointBuilder) Endpoint ¶
func (dbe DBEndpointBuilder) Endpoint() Endpoint
type Endpoint ¶
type Endpoint struct { Middlewares []middleware.Middleware Output httprouter.Handle }
func NewEndpoint ¶
func NewEndpoint() Endpoint
func (Endpoint) Handle ¶
func (e Endpoint) Handle() httprouter.Handle
func (Endpoint) PushMiddleware ¶
func (e Endpoint) PushMiddleware(m middleware.Middleware) Endpoint
type FilterFn ¶
type FilterFn func(p httprouter.Params, selector sqlbuilder.Selector) sqlbuilder.Selector
type InsertEndpointBuilder ¶
type InsertEndpointBuilder struct { DBEndpointBuilder Collection string }
func NewInsertEndpointBuilder ¶
func NewInsertEndpointBuilder(collection string, input Factory, pre, post []middleware.Middleware) InsertEndpointBuilder
func (InsertEndpointBuilder) Endpoint ¶
func (dbe InsertEndpointBuilder) Endpoint() Endpoint
type InsertMessage ¶
type InsertedIDContextKey ¶
type InsertedIDContextKey struct{}
InsertedIDContextKey - context key which stores the inserted object's ID
type JwtClaimsContextKey ¶
type JwtClaimsContextKey struct{}
JwtClaimsContextKey - context key which stores the request's jwt.MapClaims
type ObjectContextKey ¶
type ObjectContextKey struct{}
ObjectContextKey - context key which stores the decoced object
type QueryObjectContextKey ¶
type QueryObjectContextKey struct{}
ObjectContextKey - context key which stores the decoced object
type SelectEndpointBuilder ¶
type SelectEndpointBuilder struct { DBEndpointBuilder Selector middleware.Middleware Collection string }
func NewSelectEndpointBuilder ¶
func NewSelectEndpointBuilder(collection string, param, factory Factory, pre, post []middleware.Middleware) SelectEndpointBuilder
func NewSelectOneEndpointBuilder ¶
func NewSelectOneEndpointBuilder(collection string, param, factory Factory, pre, post []middleware.Middleware) SelectEndpointBuilder
func (SelectEndpointBuilder) Endpoint ¶
func (dbe SelectEndpointBuilder) Endpoint() Endpoint
func (SelectEndpointBuilder) SetSelector ¶
func (dbe SelectEndpointBuilder) SetSelector(selector middleware.Middleware) SelectEndpointBuilder
type SelectParams ¶
type SelectParamsOffsetLimit ¶
func (*SelectParamsOffsetLimit) GetLimit ¶
func (p *SelectParamsOffsetLimit) GetLimit() int
func (*SelectParamsOffsetLimit) GetOffset ¶
func (p *SelectParamsOffsetLimit) GetOffset() int
type SelectResultContextKey ¶
type SelectResultContextKey struct{}
type SelectorContextKey ¶
type SelectorContextKey struct{}
type SelectorFn ¶
type SelectorFn func(sqlbuilder.Database) sqlbuilder.Selector
type SessContextKey ¶
type SessContextKey struct{}
SessContextKey - context key which stores the DB session object
type UpdateEndpointBuilder ¶
type UpdateEndpointBuilder struct { DBEndpointBuilder Collection string }
func NewUpdateEndpointBuilder ¶
func NewUpdateEndpointBuilder(collection string, input Factory, pre, post []middleware.Middleware) UpdateEndpointBuilder
func (UpdateEndpointBuilder) Endpoint ¶
func (dbe UpdateEndpointBuilder) Endpoint() Endpoint
type UpdatedIDContextKey ¶
type UpdatedIDContextKey struct{}
UpdatedIDContextKey - context key which stores the updated object's ID
type UserIDContextKey ¶
type UserIDContextKey struct{}
UserIDContextKey - context key which stores the request's userID