Documentation
¶
Index ¶
- Constants
- Variables
- type Inertia
- func (i *Inertia) DisableSsr()
- func (i *Inertia) EnableSsr(ssrURL string, client ...*http.Client)
- func (i *Inertia) EnableSsrWithDefault(client ...*http.Client)
- func (i *Inertia) IsSsrEnabled() bool
- func (i *Inertia) Location(w http.ResponseWriter, r *http.Request, url string)
- func (i *Inertia) Middleware(next http.Handler) http.Handler
- func (i *Inertia) Render(w http.ResponseWriter, r *http.Request, component string, props map[string]any) error
- func (i *Inertia) Share(key string, value any)
- func (i *Inertia) ShareFunc(key string, value any)
- func (i *Inertia) ShareViewData(key string, value any)
- func (i *Inertia) WithAlwaysProp(ctx context.Context, key string, value func() any) context.Context
- func (i *Inertia) WithClearHistory(ctx context.Context) context.Context
- func (i *Inertia) WithDeepMergeProp(ctx context.Context, key string, value func() any, matchOn ...string) context.Context
- func (i *Inertia) WithDeferredProp(ctx context.Context, key string, value func() any, group ...string) context.Context
- func (i *Inertia) WithEncryptHistory(ctx context.Context) context.Context
- func (i *Inertia) WithErrorProp(ctx context.Context, key string, value any) context.Context
- func (i *Inertia) WithFlash(ctx context.Context, data map[string]any) context.Context
- func (i *Inertia) WithMergeProp(ctx context.Context, key string, value func() any, matchOn ...string) context.Context
- func (i *Inertia) WithOnce(ctx context.Context, key string, prop ...OncePageProp) context.Context
- func (i *Inertia) WithOnceProp(ctx context.Context, key string, value func() any) context.Context
- func (i *Inertia) WithOptionalProp(ctx context.Context, key string, value func() any) context.Context
- func (i *Inertia) WithPrependProp(ctx context.Context, key string, value func() any, matchOn ...string) context.Context
- func (i *Inertia) WithPreserveFragment(ctx context.Context) context.Context
- func (i *Inertia) WithProp(ctx context.Context, key string, value any) context.Context
- func (i *Inertia) WithScrollProp(ctx context.Context, key string, prop ScrollPageProp) context.Context
- func (i *Inertia) WithViewData(ctx context.Context, key string, value any) context.Context
- type OncePageProp
- type Page
- type ScrollPageProp
- type Ssr
Constants ¶
View Source
const ( // HeaderInertia header. HeaderInertia = "X-Inertia" // HeaderLocation header. HeaderLocation = "X-Inertia-Location" // HeaderVersion header. HeaderVersion = "X-Inertia-Version" // HeaderPartialComponent header. HeaderPartialComponent = "X-Inertia-Partial-Component" // HeaderPartialOnly header. HeaderPartialOnly = "X-Inertia-Partial-Data" // HeaderPartialExcept header. HeaderPartialExcept = "X-Inertia-Partial-Except" // HeaderExceptOnceProps header. HeaderExceptOnceProps = "X-Inertia-Except-Once-Props" // HeaderReset header. HeaderReset = "X-Inertia-Reset" )
Variables ¶
View Source
var ( // ErrBadSsrStatusCode error. ErrBadSsrStatusCode = errors.New("inertia: bad ssr status code >= 400") // ErrInvalidContextValue error. ErrInvalidContextValue = errors.New("inertia: could not convert context value to expected type") )
Functions ¶
This section is empty.
Types ¶
type Inertia ¶
type Inertia struct {
// contains filtered or unexported fields
}
Inertia type.
func (*Inertia) EnableSsrWithDefault ¶ added in v1.5.0
EnableSsrWithDefault function.
func (*Inertia) IsSsrEnabled ¶ added in v1.5.0
IsSsrEnabled function.
func (*Inertia) Middleware ¶
Middleware function.
func (*Inertia) Render ¶
func (i *Inertia) Render(w http.ResponseWriter, r *http.Request, component string, props map[string]any) error
Render function.
func (*Inertia) ShareViewData ¶ added in v1.10.0
ShareViewData function.
func (*Inertia) WithAlwaysProp ¶ added in v1.14.0
WithAlwaysProp function.
func (*Inertia) WithClearHistory ¶ added in v1.14.0
WithClearHistory function.
func (*Inertia) WithDeepMergeProp ¶ added in v1.14.0
func (i *Inertia) WithDeepMergeProp(ctx context.Context, key string, value func() any, matchOn ...string) context.Context
WithDeepMergeProp function.
func (*Inertia) WithDeferredProp ¶ added in v1.14.0
func (i *Inertia) WithDeferredProp(ctx context.Context, key string, value func() any, group ...string) context.Context
WithDeferredProp function.
func (*Inertia) WithEncryptHistory ¶ added in v1.14.0
WithEncryptHistory function.
func (*Inertia) WithErrorProp ¶ added in v1.15.0
WithErrorProp function.
func (*Inertia) WithMergeProp ¶ added in v1.14.0
func (i *Inertia) WithMergeProp(ctx context.Context, key string, value func() any, matchOn ...string) context.Context
WithMergeProp function.
func (*Inertia) WithOnceProp ¶ added in v1.14.0
WithOnceProp function.
func (*Inertia) WithOptionalProp ¶ added in v1.14.0
func (i *Inertia) WithOptionalProp(ctx context.Context, key string, value func() any) context.Context
WithOptionalProp function.
func (*Inertia) WithPrependProp ¶ added in v1.14.0
func (i *Inertia) WithPrependProp(ctx context.Context, key string, value func() any, matchOn ...string) context.Context
WithPrependProp function.
func (*Inertia) WithPreserveFragment ¶ added in v1.15.0
WithPreserveFragment function.
func (*Inertia) WithScrollProp ¶ added in v1.14.0
func (i *Inertia) WithScrollProp(ctx context.Context, key string, prop ScrollPageProp) context.Context
WithScrollProp function.
type OncePageProp ¶ added in v1.14.0
type OncePageProp struct {
Prop string `json:"prop"`
ExpiresAt *int64 `json:"expiresAt,omitempty"`
}
OncePageProp type.
type Page ¶
type Page struct {
Component string `json:"component"`
Props map[string]any `json:"props"`
URL string `json:"url"`
Version string `json:"version"`
DeferredProps map[string][]string `json:"deferredProps,omitempty"`
MergeProps []string `json:"mergeProps,omitempty"`
DeepMergeProps []string `json:"deepMergeProps,omitempty"`
PrependProps []string `json:"prependProps,omitempty"`
MatchPropsOn []string `json:"matchPropsOn,omitempty"`
ScrollProps map[string]ScrollPageProp `json:"scrollProps,omitempty"`
OnceProps map[string]OncePageProp `json:"onceProps,omitempty"`
Flash map[string]any `json:"flash,omitempty"`
ClearHistory bool `json:"clearHistory,omitempty"`
EncryptHistory bool `json:"encryptHistory,omitempty"`
PreserveFragment bool `json:"preserveFragment,omitempty"`
}
Page type.
Click to show internal directories.
Click to hide internal directories.