inertia

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 9 Imported by: 0

README

About

This adapter is based on the inertia-go by Peter Takacs which uses Net/HTTP. While this adapter uses FastHTTP and GoFiber

Credits

License

This open-sourced software is licensed under the MIT license.

Documentation

Index

Constants

View Source
const ContextKeyProps = contextKey("props")

ContextKeyProps key.

View Source
const ContextKeyViewData = contextKey("viewData")

ContextKeyViewData key.

Variables

View Source
var (
	// ErrInvalidContextProps error.
	ErrInvalidContextProps = errors.New("inertia: could not convert context props to map")

	// ErrInvalidContextViewData error.
	ErrInvalidContextViewData = errors.New("inertia: could not convert context view data to map")

	// ErrBadSsrStatusCode error.
	ErrBadSsrStatusCode = errors.New("inertia: bad ssr status code >= 400")
)

Functions

This section is empty.

Types

type Inertia

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

Inertia type.

func New

func New(url, rootTemplate, version string) *Inertia

New function.

func NewWithFS

func NewWithFS(url, rootTemplate, version string, templateFS fs.FS) *Inertia

NewWithFS function.

func (*Inertia) DisableSsr

func (i *Inertia) DisableSsr()

DisableSsr function.

func (*Inertia) EnableSsr

func (i *Inertia) EnableSsr(ssrURL string)

EnableSsr function.

func (*Inertia) EnableSsrWithDefault

func (i *Inertia) EnableSsrWithDefault()

EnableSsrWithDefault function.

func (*Inertia) IsSsrEnabled

func (i *Inertia) IsSsrEnabled() bool

IsSsrEnabled function.

func (*Inertia) Location

func (i *Inertia) Location(c *fiber.Ctx, url string)

Location function.

func (*Inertia) Middleware

func (i *Inertia) Middleware(next fiber.Handler) fiber.Handler

Middleware function.

func (*Inertia) Render

func (i *Inertia) Render(c *fiber.Ctx, component string, props map[string]interface{}) error

Render function.

func (*Inertia) Share

func (i *Inertia) Share(key string, value interface{})

Share function.

func (*Inertia) ShareFunc

func (i *Inertia) ShareFunc(key string, value interface{})

ShareFunc function.

func (*Inertia) WithProp

func (i *Inertia) WithProp(ctx context.Context, key string, value interface{}) context.Context

WithProp function.

func (*Inertia) WithViewData

func (i *Inertia) WithViewData(ctx context.Context, key string, value interface{}) context.Context

WithViewData function.

type Page

type Page struct {
	Component string                 `json:"component"`
	Props     map[string]interface{} `json:"props"`
	URL       string                 `json:"url"`
	Version   string                 `json:"version"`
}

Page type.

type Ssr

type Ssr struct {
	Head []string `json:"head"`
	Body string   `json:"body"`
}

Ssr type.

Jump to

Keyboard shortcuts

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