Documentation ¶
Index ¶
Constants ¶
View Source
const ( FormXSRF = "_xsrf" CookieXSRF = "_xsrf" )
Variables ¶
View Source
var ErrDuplicatedName = errors.New("duplicated form name")
Functions ¶
func XSRF ¶
func XSRF(writer http.ResponseWriter) string
XSRF protection token. Returned token should be submitted as _xsrf form value. Panics if crypto generator is not available.
Types ¶
type AMQPFactory ¶ added in v0.3.0
type AMQPFactory interface {
Create(definition schema.AMQP) notifications.Notification
}
type Config ¶
type Config struct { Forms []schema.Form Storage Storage WebhooksFactory WebhooksFactory AMQPFactory AMQPFactory Listing bool }
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
func NewForm ¶
func NewForm(config FormConfig, options ...FormOption) *Form
type FormConfig ¶
type FormConfig struct { Definition schema.Form // schema definition Renderer *Renderer // renderer for template blocks ViewForm *template.Template // template to show main form ViewResult *template.Template // template to show result after submit Storage Storage // where to store data WebhooksFactory WebhooksFactory AMQPFactory AMQPFactory XSRF bool // check XSRF token. Disable if form is exposed as API. }
type FormOption ¶
type FormOption func(config *FormConfig)
func WithXSRF ¶
func WithXSRF(enable bool) FormOption
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
type ResultContext ¶
type ResultContext struct {
// contains filtered or unexported fields
}
func (*ResultContext) Error ¶
func (rc *ResultContext) Error() error
func (*ResultContext) Form ¶
func (rc *ResultContext) Form() schema.Form
func (*ResultContext) Result ¶
func (rc *ResultContext) Result() map[string]any
type ViewContext ¶
func (*ViewContext) FieldError ¶
func (vc *ViewContext) FieldError(name string) error
func (*ViewContext) LastValue ¶
func (vc *ViewContext) LastValue(name string) string
func (*ViewContext) LastValues ¶
func (vc *ViewContext) LastValues(name string) utils.Set[string]
type WebhooksFactory ¶ added in v0.3.0
type WebhooksFactory interface {
Create(webhook schema.Webhook) notifications.Notification
}
Click to show internal directories.
Click to hide internal directories.