tx

package
v0.0.0-...-8577a5a Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderError

func RenderError(w http.ResponseWriter, err error)

func RenderWrap

func RenderWrap(w http.ResponseWriter, err error, code int, wrap string)

Types

type Handler

type Handler = func(Request) (render interface{}, err error)

Handler is the function signature for transaction handlers. Render could be Renderer.

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

func NewMiddleware

func NewMiddleware(db *db.Database, up upload.UploadConfig) Middleware

func (Middleware) M

type Middlewarer

type Middlewarer = func(Handler) http.HandlerFunc

Middlewarer is the interface for the transaction middleware.

type Renderer

type Renderer = func(w http.ResponseWriter) error

Renderer is a possible return type for Handler's render.

type Request

type Request struct {
	*http.Request

	Up *upload.UploadConfig
	Tx *db.Transaction
	// contains filtered or unexported fields
}

func (Request) Param

func (r Request) Param(s string) string

Param is a helper function that returns a URL parameter from chi.

func (*Request) SetSession

func (r *Request) SetSession(s *smolboard.Session)

SetSession sets the written token cookie to the given session. The given session can be nil.

Jump to

Keyboard shortcuts

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