model

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyModelRoute

type AnyModelRoute interface {
	Adapter() path.AnyAdapter
	Handle(w http.ResponseWriter, r *http.Request, a any, sess *instance.Session, opt instance.Options) (Res, bool)
}

AnyModelRoute is the internal representation of a registered page model.

func NewModelRoute

func NewModelRoute[M any](a path.Adapter[M], h Handler[M]) AnyModelRoute

NewModelRoute creates a model-backed route from a path adapter and handler.

type Handler

type Handler[M any] = func(w http.ResponseWriter, r *http.Request, source beam.Source[M], store ctex.Store) Res

type InstanceCreationError

type InstanceCreationError struct{}

func (InstanceCreationError) Error

func (i InstanceCreationError) Error() string

type Res

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

Res describes the result of handling a registered model route.

func ResComp

func ResComp(comp gox.Comp) Res

ResComp returns a Res that renders comp.

func ResRedirect

func ResRedirect(model any, status int) Res

ResRedirect returns a Res that redirects to model.

func ResReroute

func ResReroute(model any) Res

ResReroute returns a Res that reroutes to model on the server.

func (Res) Entity

func (r Res) Entity() any

Entity returns the raw underlying response payload.

func (Res) Err

func (r Res) Err() error

Err returns the response error, if any.

func (Res) Instance

func (r Res) Instance() (instance.AnyInstance, bool)

Instance returns the created page instance, if this response rendered one.

func (Res) Redirect

func (r Res) Redirect() (any, int, bool)

Redirect returns the redirect target model and status, if any.

func (Res) Reroute

func (r Res) Reroute() (any, bool)

Reroute returns the reroute target model, if any.

Jump to

Keyboard shortcuts

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