Documentation
¶
Index ¶
- func NewRoute(dp RouteDataProvider) web.Route
- type DP
- func (p *DP) Data(ctx context.Context, r *web.Request, _ web.ResponseWriter, data *RouteData) error
- func (p *DP) Guard(ctx context.Context, r *web.Request) error
- func (p *DP) InitReceive(context.Context, *web.Request, web.ResponseWriter, *FormReceiveValues) error
- func (p *DP) ProcessReceive(ctx context.Context, r *web.Request, _ web.ResponseWriter, ...) error
- func (p *DP) Subscribe(ctx context.Context, r *web.Request, state *ReactiveState) error
- type FormReceiveValues
- type Message
- type ReactiveState
- type RouteData
- type RouteDataProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRoute ¶
func NewRoute(dp RouteDataProvider) web.Route
NewRoute returns the page for this folder.
Types ¶
type DP ¶
type DP struct {
// contains filtered or unexported fields
}
DP provides the mail of the app the URL names.
func (*DP) Guard ¶
Guard answers 404 for a name that is not an app of the workspace, before the form or the live connection reaches the backend.
func (*DP) InitReceive ¶
func (p *DP) InitReceive(context.Context, *web.Request, web.ResponseWriter, *FormReceiveValues) error
InitReceive leaves the form empty.
func (*DP) ProcessReceive ¶
func (p *DP) ProcessReceive(ctx context.Context, r *web.Request, _ web.ResponseWriter, f *FormReceiveValues) error
ProcessReceive puts the message into the app's inbox and shows the mail again; it shows why when the workspace refuses the message.
type FormReceiveValues ¶
type FormReceiveValues struct {
form.BaseFormValues
From form.Input[string]
Subject form.Input[string]
Text form.Textarea
}
FormReceiveValues holds the fields of the form receive.
type Message ¶
type Message struct {
ID string
Folder string
Stamp string // the time as RFC 3339
Time string
From string
To string
Subject string
}
Message sums up one message as the page shows it.
type ReactiveState ¶
type ReactiveState struct {
// contains filtered or unexported fields
}
ReactiveState sends new values of the page's live variables to one open page. Its Set methods may be called from any goroutine.
func (*ReactiveState) SetMail ¶
func (rs *ReactiveState) SetMail(v []Message)
SetMail stores v as mail and sends the parts of the page that show it.
type RouteDataProvider ¶
type RouteDataProvider interface {
Guard(ctx context.Context, r *web.Request) error
Data(ctx context.Context, r *web.Request, w web.ResponseWriter, data *RouteData) error
InitReceive(ctx context.Context, r *web.Request, w web.ResponseWriter, data *FormReceiveValues) error
ProcessReceive(ctx context.Context, r *web.Request, w web.ResponseWriter, data *FormReceiveValues) error
// Subscribe runs while the page is open and must return when ctx is done.
Subscribe(ctx context.Context, r *web.Request, state *ReactiveState) error
}
RouteDataProvider is what this page's DP implements.