Documentation
¶
Overview ¶
Package decide provides the constructors for app.Decision values returned from Policy.Decide implementations. Lives in a subpackage (rather than under app directly) so call sites read like `decide.Block(403, "no")` without shadowing common variable names ("block", "redirect") that authors reach for.
import (
"github.com/DonaldMurillo/gofastr/core-ui/app"
"github.com/DonaldMurillo/gofastr/core-ui/app/decide"
)
pol := app.PolicyFunc(func(ctx context.Context) app.Decision {
if authed(ctx) { return decide.Allow() }
return decide.Redirect("/login")
})
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Block ¶
Block returns a Decision that aborts with status (e.g. 401, 403, 404). Message is optional human-readable text.
func Redirect ¶
Redirect returns a Decision that redirects the request to url. Hosts typically use HTTP 303 See Other so POST→Redirect→GET works.
func RenderAlt ¶
RenderAlt returns a Decision that renders an alt component in place of the screen's own. factory MUST return a FRESH instance per call — the framework invokes it once per request and the returned component is then mutated by SetParams / Inject / Load under the screen lock. Sharing a singleton is a cross-user data leak.
Types ¶
This section is empty.