types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PageConfig

type PageConfig struct {
	ComponentPath    string
	Mode             PageMode
	PropsLoader      PropsLoader
	StaticDataLoader StaticDataLoader
}

type PageMode

type PageMode int
const (
	ModeSSR PageMode = iota
	ModeClientOnly
	ModeStaticPrerender
)

type PageOption

type PageOption func(*PageConfig)

func WithClientOnly

func WithClientOnly() PageOption

func WithPropsLoader

func WithPropsLoader(loader PropsLoader) PageOption

func WithStaticDataLoader

func WithStaticDataLoader(loader StaticDataLoader) PageOption

func WithStaticPrerender

func WithStaticPrerender() PageOption

type PropsLoader

type PropsLoader func(*http.Request) (map[string]any, error)

type RedirectError

type RedirectError interface {
	RedirectURL() string
	RedirectStatusCode() int
}

type RenderedPage

type RenderedPage struct {
	Body string
	Head string
}

type StaticDataLoader

type StaticDataLoader func(context.Context) ([]StaticPathData, error)

StaticDataLoader is called at build time to generate dynamic static paths It returns a list of paths and their corresponding props Example: returning [{Path: "/blog/hello", Props: {slug: "hello"}}] will generate a prerendered page at /blog/hello with those props

type StaticPathData

type StaticPathData struct {
	Path  string
	Props map[string]any
}

StaticPathData represents a single path and its props for static prerendering

Jump to

Keyboard shortcuts

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