Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func WithCredentials ¶ added in v0.2.0
func WithCredentials(ctx context.Context, creds *Credentials) context.Context
Types ¶
type Credentials ¶ added in v0.2.0
func CredentialsFromContext ¶ added in v0.2.0
func CredentialsFromContext(ctx context.Context) *Credentials
type Field ¶
type Field struct {
Name string // column name in database.
Label string // short name of field which will be shown in UI, if not set - [Field.Name] is used.
Description string // (markdown) optional description for the field, also shown in UI as help text.
Required bool // make field as required: empty values will not be accepted as well as at least one option should be selected.
Disabled bool // user input will be ignored, by field will be visible in UI. Doesn't apply for options.
Hidden bool // user input will be ignored, field not visible in UI
Default string // golang template expression for the default value. Doesn't apply for options with [Field.Multiple].
Type Type // (default [TypeString]) field type used for user input validation.
Pattern string // optional regexp to validate content, applicable only for string type
Options []Option // allowed values. If [Field.Multiple] set, it acts as "any of", otherwise "one of".
Multiple bool // allow picking multiple options. Column type in database MUST be ARRAY of corresponding type.
Multiline bool // multiline input (for [TypeString] only)
Icon string // optional MDI icon
}
type Form ¶
type Form struct {
Name string // unique form name, if not set - file name without extension will be used.
Table string // database table name
Title string // optional title for the form
Description string // (markdown) optional description of the form
Fields []Field
Webhooks []Webhook
Success string // markdown message for success (also go template with available .Result)
Failed string // markdown message for failed (also go template with .Error)
Policy *Policy // optional access policy
}
func (*Form) IsAllowed ¶ added in v0.2.0
func (f *Form) IsAllowed(creds *Credentials) bool
IsAllowed checks permission for the provided credentials. Always allowed for nil policy or for nil creds, and always prohibited if policy returns non-boolean value.
type Policy ¶ added in v0.2.0
func (*Policy) UnmarshalText ¶ added in v0.2.0
type Template ¶
func (*Template) UnmarshalText ¶
type Webhook ¶
type Webhook struct {
URL string // URL for POST webhook, where payload is JSON with fields from database column.
Method string // HTTP method to perform, default is POST
Retry int // maximum number of retries (negative means no retries)
Timeout time.Duration // request timeout
Interval time.Duration // interval between attempts (for non 2xx code)
Headers map[string]string // arbitrary headers (ex: Authorization)
Message *Template // payload content, if not set - JSON representation of storage result
}
Click to show internal directories.
Click to hide internal directories.