Documentation
¶
Index ¶
- func GenerateUploadIDWithTaskContext(ctx context.Context, formId string) string
- type CheckboxFormDefaultValueGenerator
- type CheckboxFormHintGenerator
- type CheckboxFormReadonlyProvider
- type CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) Build(labelOpts ...coretask.LabelOpt) coretask.Task[bool]
- func (b *CheckboxFormTaskBuilder) WithDefaultValue(defValue bool) *CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) WithDefaultValueFunc(defFunc CheckboxFormDefaultValueGenerator) *CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) WithDependencies(dependencies []coretask.Dependency) *CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) WithDescription(description string) *CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) WithHintFunc(hintFunc CheckboxFormHintGenerator) *CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) WithReadonly(readonly bool) *CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) WithReadonlyFunc(readonlyFunc CheckboxFormReadonlyProvider) *CheckboxFormTaskBuilder
- func (b *CheckboxFormTaskBuilder) WithValidator(validator CheckboxFormValidator) *CheckboxFormTaskBuilder
- type CheckboxFormValidator
- type FileFormTaskBuilder
- type FormTaskBuilderBase
- func (b *FormTaskBuilderBase[T]) SetupBaseFormField(field *inspectionmetadata.ParameterFormFieldBase)
- func (b *FormTaskBuilderBase[T]) WithDependencies(dependencies []coretask.Dependency) *FormTaskBuilderBase[T]
- func (b *FormTaskBuilderBase[T]) WithDescription(description string) *FormTaskBuilderBase[T]
- type SetFormBoolProvider
- type SetFormDefaultValueGenerator
- type SetFormHintGenerator
- type SetFormOptionsProvider
- type SetFormTaskBuilder
- func (b *SetFormTaskBuilder[T]) Build(labelOpts ...coretask.LabelOpt) coretask.Task[T]
- func (b *SetFormTaskBuilder[T]) WithAllowAddAll(allow bool) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithAllowAddAllFunc(allowFunc SetFormBoolProvider) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithAllowCustomValue(allow bool) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithAllowCustomValueFunc(allowFunc SetFormBoolProvider) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithAllowRemoveAll(allow bool) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithAllowRemoveAllFunc(allowFunc SetFormBoolProvider) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithConverter(converter SetFormValueConverter[T]) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithDefaultValueConstant(defValue []string, preferPrevValue bool) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithDefaultValueFunc(defFunc SetFormDefaultValueGenerator) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithDependencies(dependencies []coretask.Dependency) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithDescription(description string) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithHintFunc(hintFunc SetFormHintGenerator) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithOptionsConstant(options []inspectionmetadata.SetParameterFormFieldOptionItem) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithOptionsFunc(optionsFunc SetFormOptionsProvider) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithOptionsSimple(options []string) *SetFormTaskBuilder[T]
- func (b *SetFormTaskBuilder[T]) WithValidator(validator SetFormValidator) *SetFormTaskBuilder[T]
- type SetFormValidator
- type SetFormValueConverter
- type TextFormDefaultValueGenerator
- type TextFormHintGenerator
- type TextFormReadonlyProvider
- type TextFormSuggestionsProvider
- type TextFormTaskBuilder
- func (b *TextFormTaskBuilder[T]) Build(labelOpts ...coretask.LabelOpt) coretask.Task[T]
- func (b *TextFormTaskBuilder[T]) WithConverter(converter TextFormValueConverter[T]) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDefaultValueConstant(defValue string, preferPrevValue bool) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDefaultValueFunc(defFunc TextFormDefaultValueGenerator) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDependencies(dependencies []coretask.Dependency) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithDescription(description string) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithHintFunc(hintFunc TextFormHintGenerator) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithReadonlyFunc(readonlyFunc TextFormReadonlyProvider) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithSuggestionsConstant(suggestions []string) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithSuggestionsFunc(suggestionsFunc TextFormSuggestionsProvider) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithValidatingTiming(timing inspectionmetadata.TextFormValidationTimingType) *TextFormTaskBuilder[T]
- func (b *TextFormTaskBuilder[T]) WithValidator(validator TextFormValidator) *TextFormTaskBuilder[T]
- type TextFormValidator
- type TextFormValueConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CheckboxFormDefaultValueGenerator ¶ added in v0.59.0
CheckboxFormDefaultValueGenerator generates the default checked state for the checkbox.
type CheckboxFormHintGenerator ¶ added in v0.59.0
type CheckboxFormHintGenerator = func(ctx context.Context, value bool) (string, inspectionmetadata.ParameterHintType, error)
CheckboxFormHintGenerator generates a hint message and its severity type for the checkbox field.
type CheckboxFormReadonlyProvider ¶ added in v0.59.0
CheckboxFormReadonlyProvider determines whether the checkbox should be disabled/readonly.
type CheckboxFormTaskBuilder ¶ added in v0.59.0
type CheckboxFormTaskBuilder struct {
FormTaskBuilderBase[bool]
// contains filtered or unexported fields
}
CheckboxFormTaskBuilder builds a DAG task that renders and processes a checkbox form field.
func NewCheckboxFormTaskBuilder ¶ added in v0.59.0
func NewCheckboxFormTaskBuilder(id taskid.TaskImplementationID[bool], priority int, fieldLabel string) *CheckboxFormTaskBuilder
NewCheckboxFormTaskBuilder constructs a new CheckboxFormTaskBuilder instance.
func (*CheckboxFormTaskBuilder) Build ¶ added in v0.59.0
Build creates a DAG task instance from this builder definition.
func (*CheckboxFormTaskBuilder) WithDefaultValue ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithDefaultValue(defValue bool) *CheckboxFormTaskBuilder
WithDefaultValue sets a constant default checked state.
func (*CheckboxFormTaskBuilder) WithDefaultValueFunc ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithDefaultValueFunc(defFunc CheckboxFormDefaultValueGenerator) *CheckboxFormTaskBuilder
WithDefaultValueFunc sets dynamic generator for the default checked state.
func (*CheckboxFormTaskBuilder) WithDependencies ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithDependencies(dependencies []coretask.Dependency) *CheckboxFormTaskBuilder
WithDependencies sets upstream task dependencies for this checkbox task.
func (*CheckboxFormTaskBuilder) WithDescription ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithDescription(description string) *CheckboxFormTaskBuilder
WithDescription sets the explanatory description for the checkbox field.
func (*CheckboxFormTaskBuilder) WithHintFunc ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithHintFunc(hintFunc CheckboxFormHintGenerator) *CheckboxFormTaskBuilder
WithHintFunc sets dynamic generator for hint message and hint type.
func (*CheckboxFormTaskBuilder) WithReadonly ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithReadonly(readonly bool) *CheckboxFormTaskBuilder
WithReadonly sets a constant readonly state for the checkbox.
func (*CheckboxFormTaskBuilder) WithReadonlyFunc ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithReadonlyFunc(readonlyFunc CheckboxFormReadonlyProvider) *CheckboxFormTaskBuilder
WithReadonlyFunc sets dynamic provider for the readonly state.
func (*CheckboxFormTaskBuilder) WithValidator ¶ added in v0.59.0
func (b *CheckboxFormTaskBuilder) WithValidator(validator CheckboxFormValidator) *CheckboxFormTaskBuilder
WithValidator sets the validation function for the checkbox value.
type CheckboxFormValidator ¶ added in v0.59.0
CheckboxFormValidator validates whether the given boolean value is valid. Returns an empty string when valid, or an error message to display on the frontend. The second return value is used for unrecoverable errors during validation.
type FileFormTaskBuilder ¶
type FileFormTaskBuilder struct {
FormTaskBuilderBase[upload.UploadResult]
// contains filtered or unexported fields
}
func NewFileFormTaskBuilder ¶
func NewFileFormTaskBuilder(id taskid.TaskImplementationID[upload.UploadResult], priority int, label string, verifier upload.UploadFileVerifier) *FileFormTaskBuilder
func (*FileFormTaskBuilder) Build ¶
func (b *FileFormTaskBuilder) Build(labelOpts ...coretask.LabelOpt) coretask.Task[upload.UploadResult]
func (*FileFormTaskBuilder) WithDependencies ¶
func (b *FileFormTaskBuilder) WithDependencies(dependencies []coretask.Dependency) *FileFormTaskBuilder
WithDependencies sets the task dependencies
func (*FileFormTaskBuilder) WithDescription ¶
func (b *FileFormTaskBuilder) WithDescription(description string) *FileFormTaskBuilder
WithDescription sets the description for the form field
type FormTaskBuilderBase ¶
type FormTaskBuilderBase[T any] struct { // contains filtered or unexported fields }
FormTaskBuilderBase provides common functionality for form task builders
func NewFormTaskBuilderBase ¶
func NewFormTaskBuilderBase[T any](id taskid.TaskImplementationID[T], priority int, label string) FormTaskBuilderBase[T]
NewFormTaskBuilderBase creates a new instance of the base builder
func (*FormTaskBuilderBase[T]) SetupBaseFormField ¶
func (b *FormTaskBuilderBase[T]) SetupBaseFormField(field *inspectionmetadata.ParameterFormFieldBase)
SetupBaseFormField configures common form field properties
func (*FormTaskBuilderBase[T]) WithDependencies ¶
func (b *FormTaskBuilderBase[T]) WithDependencies(dependencies []coretask.Dependency) *FormTaskBuilderBase[T]
WithDependencies sets the task dependencies
func (*FormTaskBuilderBase[T]) WithDescription ¶
func (b *FormTaskBuilderBase[T]) WithDescription(description string) *FormTaskBuilderBase[T]
WithDescription sets the description for the form field
type SetFormBoolProvider ¶ added in v0.51.0
SetFormBoolProvider is a function type to provide boolean flags dynamically.
type SetFormDefaultValueGenerator ¶ added in v0.51.0
type SetFormDefaultValueGenerator = func(ctx context.Context, previousValues []string) ([]string, error)
SetFormDefaultValueGenerator is a function type to generate the default value.
type SetFormHintGenerator ¶ added in v0.51.0
type SetFormHintGenerator = func(ctx context.Context, value []string, convertedValue any) (string, inspectionmetadata.ParameterHintType, error)
SetFormHintGenerator is a function type to generate a hint string
type SetFormOptionsProvider ¶ added in v0.51.0
type SetFormOptionsProvider = func(ctx context.Context, previousValues []string) ([]inspectionmetadata.SetParameterFormFieldOptionItem, error)
SetFormOptionsProvider is a function to return the list of options.
type SetFormTaskBuilder ¶ added in v0.51.0
type SetFormTaskBuilder[T any] struct { FormTaskBuilderBase[T] // contains filtered or unexported fields }
SetFormTaskBuilder is an utility to construct an instance of task for input form field.
func NewSetFormTaskBuilder ¶ added in v0.51.0
func NewSetFormTaskBuilder[T any](id taskid.TaskImplementationID[T], priority int, fieldLabel string) *SetFormTaskBuilder[T]
NewSetFormTaskBuilder constructs an instance of SetFormTaskBuilder.
func (*SetFormTaskBuilder[T]) Build ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) Build(labelOpts ...coretask.LabelOpt) coretask.Task[T]
func (*SetFormTaskBuilder[T]) WithAllowAddAll ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithAllowAddAll(allow bool) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithAllowAddAllFunc ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithAllowAddAllFunc(allowFunc SetFormBoolProvider) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithAllowCustomValue ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithAllowCustomValue(allow bool) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithAllowCustomValueFunc ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithAllowCustomValueFunc(allowFunc SetFormBoolProvider) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithAllowRemoveAll ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithAllowRemoveAll(allow bool) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithAllowRemoveAllFunc ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithAllowRemoveAllFunc(allowFunc SetFormBoolProvider) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithConverter ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithConverter(converter SetFormValueConverter[T]) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithDefaultValueConstant ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithDefaultValueConstant(defValue []string, preferPrevValue bool) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithDefaultValueFunc ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithDefaultValueFunc(defFunc SetFormDefaultValueGenerator) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithDependencies ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithDependencies(dependencies []coretask.Dependency) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithDescription ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithDescription(description string) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithHintFunc ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithHintFunc(hintFunc SetFormHintGenerator) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithOptionsConstant ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithOptionsConstant(options []inspectionmetadata.SetParameterFormFieldOptionItem) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithOptionsFunc ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithOptionsFunc(optionsFunc SetFormOptionsProvider) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithOptionsSimple ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithOptionsSimple(options []string) *SetFormTaskBuilder[T]
func (*SetFormTaskBuilder[T]) WithValidator ¶ added in v0.51.0
func (b *SetFormTaskBuilder[T]) WithValidator(validator SetFormValidator) *SetFormTaskBuilder[T]
type SetFormValidator ¶ added in v0.51.0
SetFormValidator is a function to check if the given value is valid or not.
type SetFormValueConverter ¶ added in v0.51.0
SetFormValueConverter is a function type to convert the given string slice value to another type stored in the variable set.
type TextFormDefaultValueGenerator ¶
type TextFormDefaultValueGenerator = func(ctx context.Context, previousValues []string) (string, error)
TextFormDefaultValueGenerator is a function type to generate the default value.
type TextFormHintGenerator ¶
type TextFormHintGenerator = func(ctx context.Context, value string, convertedValue any) (string, inspectionmetadata.ParameterHintType, error)
TextFormHintGenerator is a function type to generate a hint string
type TextFormReadonlyProvider ¶
TextFormReadonlyProvider is a function type to compute if the field is allowed edit or not.
type TextFormSuggestionsProvider ¶
type TextFormSuggestionsProvider = func(ctx context.Context, value string, previousValues []string) ([]string, error)
TextFormSuggestionsProvider is a function to return the list of strings shown in the autocomplete. Return nil instead of empty string array means the autocomplete is disabled for the field.
type TextFormTaskBuilder ¶
type TextFormTaskBuilder[T any] struct { FormTaskBuilderBase[T] // contains filtered or unexported fields }
TextFormTaskBuilder is an utility to construct an instance of task for input form field. This will generate the task instance with `Build()` method call after chaining several configuration methods.
func NewTextFormTaskBuilder ¶
func NewTextFormTaskBuilder[T any](id taskid.TaskImplementationID[T], priority int, fieldLabel string) *TextFormTaskBuilder[T]
NewTextFormTaskBuilder constructs an instance of TextFormDefinitionBuilder. id,prioirity and label will be initialized with the value given in the argument. The other values are initialized with the following values. dependencies : Initialized with an empty string array indicating this task is not depending on anything. description: Initialized with an empty string. defaultValue: Initialized with a function to return empty string. validator: Initialized with a function to return empty string that indicates the validation is always passing. allowEditProvider: Initialized with a function to return true. suggestionsProvider: Initialized with a function to return nil. converter: Initialized with a function to return the given value. This means no conversion applied and treated as a string.
func (*TextFormTaskBuilder[T]) Build ¶
func (b *TextFormTaskBuilder[T]) Build(labelOpts ...coretask.LabelOpt) coretask.Task[T]
func (*TextFormTaskBuilder[T]) WithConverter ¶
func (b *TextFormTaskBuilder[T]) WithConverter(converter TextFormValueConverter[T]) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDefaultValueConstant ¶
func (b *TextFormTaskBuilder[T]) WithDefaultValueConstant(defValue string, preferPrevValue bool) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDefaultValueFunc ¶
func (b *TextFormTaskBuilder[T]) WithDefaultValueFunc(defFunc TextFormDefaultValueGenerator) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDependencies ¶
func (b *TextFormTaskBuilder[T]) WithDependencies(dependencies []coretask.Dependency) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithDescription ¶
func (b *TextFormTaskBuilder[T]) WithDescription(description string) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithHintFunc ¶
func (b *TextFormTaskBuilder[T]) WithHintFunc(hintFunc TextFormHintGenerator) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithReadonlyFunc ¶
func (b *TextFormTaskBuilder[T]) WithReadonlyFunc(readonlyFunc TextFormReadonlyProvider) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithSuggestionsConstant ¶
func (b *TextFormTaskBuilder[T]) WithSuggestionsConstant(suggestions []string) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithSuggestionsFunc ¶
func (b *TextFormTaskBuilder[T]) WithSuggestionsFunc(suggestionsFunc TextFormSuggestionsProvider) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithValidatingTiming ¶
func (b *TextFormTaskBuilder[T]) WithValidatingTiming(timing inspectionmetadata.TextFormValidationTimingType) *TextFormTaskBuilder[T]
func (*TextFormTaskBuilder[T]) WithValidator ¶
func (b *TextFormTaskBuilder[T]) WithValidator(validator TextFormValidator) *TextFormTaskBuilder[T]
type TextFormValidator ¶
TextFormValidator is a function to check if the given value is valid or not. Returns "" as the result when it has no error, otherwise the returned value is used as an error message on frontend. Returning an error as the 2nd returning value is only when the validator detects an unrecoverble error.