views

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

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 (v *ObjectView[T]) GetContext(req *http.Request) (ctx.Context, error)

func (*ObjectView[T]) GetObject

func (v *ObjectView[T]) GetObject(r *http.Request, pk any) (*queries.Row[T], error)

func (*ObjectView[T]) GetQuerySet

func (v *ObjectView[T]) GetQuerySet(r *http.Request) *queries.QuerySet[T]

type TransactionOptions

type TransactionOptions struct {
	Deadline time.Duration
}

Jump to

Keyboard shortcuts

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