mvc

package
v1.618.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: MIT Imports: 24 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete added in v1.564.0

func Delete[Model any](path string, controller Controller[Model]) bool

Delete method for mvc.

func Get added in v1.564.0

func Get[Model any](path string, controller Controller[Model]) bool

Get method for mvc.

func IsDefined added in v1.562.0

func IsDefined() bool

IsDefined for mvc.

func NewFunctionMap added in v1.568.0

func NewFunctionMap(params FunctionMapParams) sprout.FunctionMap

NewFunctionMap for sprout. List of registries can be found at https://docs.atom.codes/sprout/registries/list-of-all-registries

func NewViewPair added in v1.565.0

func NewViewPair(name string) (*View, *View)

NewViewPair returns a pair of full and partial view.

func Patch added in v1.564.0

func Patch[Model any](path string, controller Controller[Model]) bool

Patch method for mvc.

func Post added in v1.564.0

func Post[Model any](path string, controller Controller[Model]) bool

Post method for mvc.

func Put added in v1.564.0

func Put[Model any](path string, controller Controller[Model]) bool

Put method for mvc.

func Register

func Register(params RegisterParams)

Register for mvc.

func Route

func Route[Model any](path string, controller Controller[Model]) bool

Route the path with controller for mvc.

func StaticFile added in v1.559.0

func StaticFile(path, name string) bool

StaticFile to be served via path.

func StaticPathValue added in v1.559.0

func StaticPathValue(path, value, prefix string) bool

StaticPathValue to be served from a dedicated path value.

Types

type Controller

type Controller[Model any] func(ctx context.Context) (*View, *Model, error)

Controller for mvc.

type FunctionMapParams added in v1.588.0

type FunctionMapParams struct {
	fx.In

	Logger     *slog.Logger
	Registries []sprout.Registry `optional:"true"`
}

FunctionMapParams for sprout.

type Layout added in v1.562.0

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

Layout is the main template that is used for all other templates.

func NewLayout added in v1.563.0

func NewLayout(full, partial string) *Layout

NewLayout defines a full and partial layout.

func (*Layout) Full added in v1.563.0

func (l *Layout) Full() string

Full of the layout.

func (*Layout) FullName added in v1.563.0

func (l *Layout) FullName() string

FullName of the layout.

func (*Layout) IsValid added in v1.563.0

func (l *Layout) IsValid() bool

IsValid the layout.

func (*Layout) Partial added in v1.563.0

func (l *Layout) Partial() string

Partial of the layout.

func (*Layout) PartialName added in v1.563.0

func (l *Layout) PartialName() string

PartialName of the layout.

type RegisterParams added in v1.562.0

type RegisterParams struct {
	fx.In

	Mux         *http.ServeMux
	FunctionMap sprout.FunctionMap
	FileSystem  fs.FS   `optional:"true"`
	Layout      *Layout `optional:"true"`
}

RegisterParams for mvc.

type Template added in v1.590.0

type Template struct {
	Meta  meta.Map
	Model any
}

Template that is rendered by the view.

type View

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

View to render.

func NewFullView added in v1.565.0

func NewFullView(name string) *View

NewFullView to render.

func NewPartialView added in v1.563.0

func NewPartialView(name string) *View

NewPartialView to render.

func (*View) Render added in v1.402.0

func (v *View) Render(ctx context.Context, model any)

Render the view.

Jump to

Keyboard shortcuts

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