Documentation
¶
Index ¶
Constants ¶
const ( InputKindRequest = "request" InputKindStreamID = "streamID" InputKindSSE = "sse" InputKindSessionToken = "sessionToken" InputKindSession = "session" InputKindPath = "path" InputKindQuery = "query" InputKindSignals = "signals" InputKindDispatch = "dispatch" InputKindEvent = "event" )
InputKind constants identify handler input parameter kinds.
const ( OutputKindBody = "body" OutputKindHead = "head" OutputKindRedirect = "redirect" OutputKindRedirectStatus = "redirectStatus" OutputKindNewSession = "newSession" OutputKindCloseSession = "closeSession" OutputKindEnableBgStream = "enableBackgroundStreaming" OutputKindDisableRefresh = "disableRefreshAfterHidden" OutputKindErr = "err" )
OutputKind constants identify handler output return value kinds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractPage ¶
type AbstractPage struct {
Expr ast.Expr
TypeName string
Methods []*Handler
StreamOpen *Handler
StreamClose *Handler
EventHandlers []*EventHandler
Embeds []*AbstractPage
}
type App ¶
type App struct {
Fset *token.FileSet
PkgPath string
Expr ast.Expr
PageIndex *Page
PageError404 *Page
PageError500 *Page
RecoverError ast.Expr // Nullable.
GlobalHeadGenerator *GlobalHead // Nullable.
Session *SessionType // Nullable.
Pages []*Page
Events []*Event
Actions []*Handler // App-level POST/PUT/PATCH/DELETE actions.
}
type Event ¶
type Event struct {
Expr ast.Expr
TypeName string
Subject string
SubjectFields []SubjectField
}
func (*Event) HasSignalSubjectFields ¶ added in v0.7.0
HasSignalSubjectFields reports whether the event has any signal-scoped subject fields (fields with a signal:"..." tag).
func (*Event) HasSubjectFields ¶ added in v0.7.0
HasSubjectFields reports whether the event has any subject fields.
func (*Event) HasSubjectUser ¶ added in v0.7.0
HasSubjectUser reports whether the event has a SubjectUser field.
func (*Event) IsPrivate ¶ added in v0.7.0
IsPrivate reports whether the event targets specific users (has a SubjectUser field).
func (*Event) IsSignalScoped ¶ added in v0.7.0
IsSignalScoped reports whether the event uses signal-based subject routing (has at least one signal-tagged subject field).
type EventHandler ¶
type GlobalHead ¶ added in v0.4.1
type Handler ¶
type Handler struct {
Expr ast.Expr
Name string
HTTPMethod string
Route string
InputRequest *Input
InputStreamID *Input
InputSSE *Input
InputSessionToken *Input
InputSession *Input
InputPath *Input
InputQuery *Input
InputSignals *Input
InputDispatch *InputDispatch
OrderedInputs []*Input // Inputs in user-defined order.
OutputBody *TemplComponent // templ.Component body (actions only)
OutputRedirect *Output
OutputRedirectStatus *Output
OutputNewSession *Output
OutputCloseSession *Output
OutputEnableBgStream *Output
OutputDisableRefresh *Output
OutputErr *Output
OrderedOutputs []*Output // Outputs in user-defined order.
}
type HandlerGET ¶
type HandlerGET struct {
*Handler
OutputBody *TemplComponent
OutputHead *TemplComponent
}
type InputDispatch ¶
type Page ¶
type Page struct {
Expr ast.Expr
TypeName string
Route string
PageSpecialization PageSpecialization
GET *HandlerGET
Actions []*Handler
StreamOpen *Handler
StreamClose *Handler
EventHandlers []*EventHandler
Embeds []*AbstractPage
}
type PageSpecialization ¶
type PageSpecialization int8
const ( PageTypeIndex PageSpecialization PageTypeError404 PageTypeError500 )
type SessionType ¶
type SubjectField ¶ added in v0.7.0
type SubjectField struct {
FieldName string // e.g. "SubjectUser"
Name string // e.g. "User" (suffix after "Subject")
SignalName string // e.g. "instance_id" (from signal:"instance_id" tag)
Singular bool // true when the field type is string (not []string)
}
SubjectField represents a Subject-prefixed field on an event type. The field name suffix (e.g. "User" from "SubjectUser") identifies the subject segment; values are appended to the NATS subject at dispatch time.
SignalName, when non-empty, marks the field as signal-scoped: the SSE stream handler reads this signal from the client and subscribes to the subject with the signal value appended. This enables per-instance event routing without authentication.
type TemplComponent ¶
type TemplComponent struct {
*Output
}