Documentation
¶
Index ¶
- func TransactionMiddleware(opts TransactionOptions) func(next mux.Handler) mux.Handler
- type BaseView
- type ObjectView
- func (v *ObjectView[T]) Check(w http.ResponseWriter, req *http.Request) error
- func (v *ObjectView[T]) Fail(w http.ResponseWriter, req *http.Request, err error)
- func (v *ObjectView[T]) GetContext(req *http.Request) (ctx.Context, error)
- func (v *ObjectView[T]) GetObject(r *http.Request, pk any) (*queries.Row[T], error)
- func (v *ObjectView[T]) GetQuerySet(r *http.Request) *queries.QuerySet[T]
- type TransactionOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TransactionMiddleware ¶
func TransactionMiddleware(opts TransactionOptions) func(next mux.Handler) mux.Handler
Types ¶
type BaseView ¶
type BaseView = django_views.BaseView
type ObjectView ¶
type ObjectView[T attrs.Definer] struct { BaseView ObjectVar string ContextVar string // optional, used to store the object in the context Object T Permissions []string }
func (*ObjectView[T]) Check ¶
func (v *ObjectView[T]) Check(w http.ResponseWriter, req *http.Request) error
Check checks the request before serving it. Useful for checking if the request is valid before serving it. Like checking permissions, etc...
func (*ObjectView[T]) Fail ¶
func (v *ObjectView[T]) Fail(w http.ResponseWriter, req *http.Request, err error)
Fail is a helper function to fail the request. This can be used to redirect, etc.
func (*ObjectView[T]) GetContext ¶
func (*ObjectView[T]) GetQuerySet ¶
func (v *ObjectView[T]) GetQuerySet(r *http.Request) *queries.QuerySet[T]
type TransactionOptions ¶
Click to show internal directories.
Click to hide internal directories.