Documentation ¶
Index ¶
- func RegisterFieldKind(fieldKind FieldKind)
- type BoolCodec
- type CheckboxInputField
- func (f *CheckboxInputField) GetErrors() []string
- func (f *CheckboxInputField) GetKind() FieldKind
- func (f *CheckboxInputField) GetName() string
- func (f *CheckboxInputField) GetStringValue() string
- func (f *CheckboxInputField) GetValue() (interface{}, error)
- func (f *CheckboxInputField) HasErrors() bool
- func (f *CheckboxInputField) SetErrors(errors []string)
- func (f *CheckboxInputField) SetStringValue(value string)
- func (f *CheckboxInputField) SetValue(value interface{}) error
- type Codec
- type DateInputField
- func (f *DateInputField) GetErrors() []string
- func (f *DateInputField) GetKind() FieldKind
- func (f *DateInputField) GetName() string
- func (f *DateInputField) GetStringValue() string
- func (f *DateInputField) GetValue() (interface{}, error)
- func (f *DateInputField) HasErrors() bool
- func (f *DateInputField) SetErrors(errors []string)
- func (f *DateInputField) SetStringValue(value string)
- func (f *DateInputField) SetValue(value interface{}) error
- type Decoder
- type Encoder
- type Field
- type FieldKind
- type Form
- type FormSection
- type HiddenInputField
- func (f *HiddenInputField) GetErrors() []string
- func (f *HiddenInputField) GetKind() FieldKind
- func (f *HiddenInputField) GetName() string
- func (f *HiddenInputField) GetStringValue() string
- func (f *HiddenInputField) GetValue() (interface{}, error)
- func (f *HiddenInputField) HasErrors() bool
- func (f *HiddenInputField) SetErrors(_ []string)
- func (f *HiddenInputField) SetStringValue(value string)
- func (f *HiddenInputField) SetValue(value interface{}) error
- type IDField
- func (f *IDField) GetErrors() []string
- func (f *IDField) GetKind() FieldKind
- func (f *IDField) GetName() string
- func (f *IDField) GetStringValue() string
- func (f *IDField) GetValue() (interface{}, error)
- func (f *IDField) HasErrors() bool
- func (f *IDField) SetErrors(errors []string)
- func (f *IDField) SetStringValue(value string)
- func (f *IDField) SetValue(value interface{}) error
- type InputField
- type IntCodec
- type NumberInputField
- func (f *NumberInputField) GetErrors() []string
- func (f *NumberInputField) GetKind() FieldKind
- func (f *NumberInputField) GetName() string
- func (f *NumberInputField) GetStringValue() string
- func (f *NumberInputField) GetValue() (interface{}, error)
- func (f *NumberInputField) HasErrors() bool
- func (f *NumberInputField) SetErrors(errors []string)
- func (f *NumberInputField) SetStringValue(value string)
- func (f *NumberInputField) SetValue(value interface{}) error
- type OptionalBooleanInputField
- func (f *OptionalBooleanInputField) GetErrors() []string
- func (f *OptionalBooleanInputField) GetKind() FieldKind
- func (f *OptionalBooleanInputField) GetName() string
- func (f *OptionalBooleanInputField) GetStringValue() string
- func (f *OptionalBooleanInputField) GetValue() (interface{}, error)
- func (f *OptionalBooleanInputField) HasErrors() bool
- func (f *OptionalBooleanInputField) IsSelected(value string) bool
- func (f *OptionalBooleanInputField) SetErrors(errors []string)
- func (f *OptionalBooleanInputField) SetStringValue(value string)
- func (f *OptionalBooleanInputField) SetValue(value interface{}) error
- type SelectInputField
- func (f *SelectInputField) GetErrors() []string
- func (f *SelectInputField) GetKind() FieldKind
- func (f *SelectInputField) GetName() string
- func (f *SelectInputField) GetStringValue() string
- func (f *SelectInputField) GetValue() (interface{}, error)
- func (f *SelectInputField) HasErrors() bool
- func (f *SelectInputField) IsSelected(value string) bool
- func (f *SelectInputField) SetErrors(errors []string)
- func (f *SelectInputField) SetStringValue(value string)
- func (f *SelectInputField) SetValue(value interface{}) error
- type SelectInputFieldOption
- type StringCodec
- type StringListCodec
- type TextAreaInputField
- func (f *TextAreaInputField) GetErrors() []string
- func (f *TextAreaInputField) GetKind() FieldKind
- func (f *TextAreaInputField) GetName() string
- func (f *TextAreaInputField) GetStringValue() string
- func (f *TextAreaInputField) GetValue() (interface{}, error)
- func (f *TextAreaInputField) HasErrors() bool
- func (f *TextAreaInputField) SetErrors(errors []string)
- func (f *TextAreaInputField) SetStringValue(value string)
- func (f *TextAreaInputField) SetValue(value interface{}) error
- type TextInputField
- func (f *TextInputField) GetErrors() []string
- func (f *TextInputField) GetKind() FieldKind
- func (f *TextInputField) GetName() string
- func (f *TextInputField) GetStringValue() string
- func (f *TextInputField) GetValue() (interface{}, error)
- func (f *TextInputField) HasErrors() bool
- func (f *TextInputField) SetErrors(errors []string)
- func (f *TextInputField) SetStringValue(value string)
- func (f *TextInputField) SetValue(value interface{}) error
- type TimeCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterFieldKind ¶
func RegisterFieldKind(fieldKind FieldKind)
Types ¶
type BoolCodec ¶
type BoolCodec struct{}
BoolCodec is a codec for boolean values
type CheckboxInputField ¶
type CheckboxInputField struct { // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // Help is the help text of the field. Help string // Errors are the errors of the field. Errors []string // Codec is the codec of the field. Codec Codec }
CheckboxInputField represents a checkbox input field.
func (*CheckboxInputField) GetErrors ¶
func (f *CheckboxInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*CheckboxInputField) GetKind ¶
func (f *CheckboxInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*CheckboxInputField) GetName ¶
func (f *CheckboxInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*CheckboxInputField) GetStringValue ¶
func (f *CheckboxInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*CheckboxInputField) GetValue ¶
func (f *CheckboxInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*CheckboxInputField) HasErrors ¶
func (f *CheckboxInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*CheckboxInputField) SetErrors ¶
func (f *CheckboxInputField) SetErrors(errors []string)
SetErrors implements FieldDefinition.SetErrors
func (*CheckboxInputField) SetStringValue ¶
func (f *CheckboxInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*CheckboxInputField) SetValue ¶
func (f *CheckboxInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
type Codec ¶
Codec represents a serializer/deserializer for a field value.
func NewBoolCodec ¶
func NewBoolCodec() Codec
func NewIntCodec ¶
func NewIntCodec() Codec
func NewStringCodec ¶
func NewStringCodec() Codec
func NewStringListCodec ¶
func NewStringListCodec() Codec
func NewTimeCodec ¶
type DateInputField ¶
type DateInputField struct { // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // MinValue is the minimum allowed value of the field. MinValue string // MaxValue is the maximum allowed value of the field. MaxValue string // Help is the help text of the field. Help string // Errors are the errors of the field. Errors []string // Codec is the codec of the field. Codec Codec }
DateInputField represents a date input field.
func (*DateInputField) GetErrors ¶
func (f *DateInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*DateInputField) GetKind ¶
func (f *DateInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*DateInputField) GetName ¶
func (f *DateInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*DateInputField) GetStringValue ¶
func (f *DateInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*DateInputField) GetValue ¶
func (f *DateInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*DateInputField) HasErrors ¶
func (f *DateInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*DateInputField) SetErrors ¶
func (f *DateInputField) SetErrors(errors []string)
SetErrors implements FieldDefinition.SetErrors
func (*DateInputField) SetStringValue ¶
func (f *DateInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*DateInputField) SetValue ¶
func (f *DateInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
type Decoder ¶
type Decoder interface { // Decode decodes the value from a string Decode(value string) (interface{}, error) }
Decoder is the interface for decoding values
type Encoder ¶
type Encoder interface { // Encode encodes the value to a string Encode(value interface{}) (string, error) }
Encoder is the interface for serializing values
type Field ¶
type Field interface { // GetKind returns the kind of the field. GetKind() FieldKind }
Field represents a form field.
type FieldKind ¶
type FieldKind string
FieldKind represents the kind of field.
const ( // FieldKindUnknown is the default value for a field kind. FieldKindUnknown FieldKind = "unknown" // FieldKindOptionalBooleanInput is the kind of field that represents an optional boolean input. FieldKindOptionalBooleanInput FieldKind = "optionalBoolean" // FieldKindCheckboxInput is the kind of field that represents a checkbox input. FieldKindCheckboxInput FieldKind = "checkbox" // FieldKindDateInput is the kind of field that represents a date input. FieldKindDateInput FieldKind = "date" // FieldKindHiddenInput is the kind of field that represents a hidden input. FieldKindHiddenInput FieldKind = "hidden" // FieldKindID is the kind of field that represents an ID. FieldKindID FieldKind = "id" // FieldKindNumberInput is the kind of field that represents a number input. FieldKindNumberInput FieldKind = "number" // FieldKindSelect is the kind of field that represents a select input. FieldKindSelect FieldKind = "select" // FieldKindTextInput is the kind of field that represents a text input. FieldKindTextInput FieldKind = "text" // FieldKindTextarea is the kind of field that represents a textarea input. FieldKindTextarea FieldKind = "textarea" )
func AllFieldKinds ¶
func AllFieldKinds() []FieldKind
func KnownFieldKinds ¶
func KnownFieldKinds() []FieldKind
type Form ¶
type Form struct { Sections []*FormSection Title string }
func (*Form) ParseURLValues ¶
func (*Form) SetErrors ¶
func (f *Form) SetErrors(errors validation.ErrorList)
type FormSection ¶
type HiddenInputField ¶
type HiddenInputField struct { // Name is the name of the field. Name string // Value is the string value of the field. Value string // Codec is the codec of the field. Codec Codec }
HiddenInputField represents a hidden input field.
func (*HiddenInputField) GetErrors ¶
func (f *HiddenInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*HiddenInputField) GetKind ¶
func (f *HiddenInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*HiddenInputField) GetName ¶
func (f *HiddenInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*HiddenInputField) GetStringValue ¶
func (f *HiddenInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*HiddenInputField) GetValue ¶
func (f *HiddenInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*HiddenInputField) HasErrors ¶
func (f *HiddenInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*HiddenInputField) SetErrors ¶
func (f *HiddenInputField) SetErrors(_ []string)
SetErrors implements FieldDefinition.SetErrors
func (*HiddenInputField) SetStringValue ¶
func (f *HiddenInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*HiddenInputField) SetValue ¶
func (f *HiddenInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
type IDField ¶
type IDField struct { // QRCodeURL is the URL of the QR code. QRCodeURL string // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // Help is the help text of the field. Help string // Errors are the errors of the field. Errors []string // Codec is the codec of the field. Codec Codec }
IDField represents an ID field.
func (*IDField) GetStringValue ¶
GetStringValue implements FieldDefinition.GetStringValue
func (*IDField) SetStringValue ¶
SetStringValue implements FieldDefinition.SetStringValue
type InputField ¶
type InputField interface { Field // GetName returns the name of the field. GetName() string // GetStringValue returns the value of the field. GetStringValue() string // SetStringValue sets the value of the field. SetStringValue(value string) // GetValue returns the value of the field. GetValue() (interface{}, error) // SetValue sets the value of the field. SetValue(value interface{}) error // SetErrors sets the errors of the field. SetErrors(errors []string) // HasErrors returns true if the field has errors. HasErrors() bool // GetErrors returns the errors of the field. GetErrors() []string }
InputField represents an input field. It is a field that can be used to input data.
type IntCodec ¶
type IntCodec struct{}
IntCodec is a codec for integer values
type NumberInputField ¶
type NumberInputField struct { // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // Help is the help text of the field. Help string // Errors are the errors of the field. Errors []string // Codec is the codec of the field. Codec Codec }
NumberInputField represents a number input field.
func (*NumberInputField) GetErrors ¶
func (f *NumberInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*NumberInputField) GetKind ¶
func (f *NumberInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*NumberInputField) GetName ¶
func (f *NumberInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*NumberInputField) GetStringValue ¶
func (f *NumberInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*NumberInputField) GetValue ¶
func (f *NumberInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*NumberInputField) HasErrors ¶
func (f *NumberInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*NumberInputField) SetErrors ¶
func (f *NumberInputField) SetErrors(errors []string)
SetErrors implements FieldDefinition.SetErrors
func (*NumberInputField) SetStringValue ¶
func (f *NumberInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*NumberInputField) SetValue ¶
func (f *NumberInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
type OptionalBooleanInputField ¶
type OptionalBooleanInputField struct { // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // Help is the help text of the field. Help string // Errors are the errors of the field. Errors []string // Codec is the codec of the field. Codec Codec }
OptionalBooleanInputField represents a checkbox input field.
func (*OptionalBooleanInputField) GetErrors ¶
func (f *OptionalBooleanInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*OptionalBooleanInputField) GetKind ¶
func (f *OptionalBooleanInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*OptionalBooleanInputField) GetName ¶
func (f *OptionalBooleanInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*OptionalBooleanInputField) GetStringValue ¶
func (f *OptionalBooleanInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*OptionalBooleanInputField) GetValue ¶
func (f *OptionalBooleanInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*OptionalBooleanInputField) HasErrors ¶
func (f *OptionalBooleanInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*OptionalBooleanInputField) IsSelected ¶
func (f *OptionalBooleanInputField) IsSelected(value string) bool
func (*OptionalBooleanInputField) SetErrors ¶
func (f *OptionalBooleanInputField) SetErrors(errors []string)
SetErrors implements FieldDefinition.SetErrors
func (*OptionalBooleanInputField) SetStringValue ¶
func (f *OptionalBooleanInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*OptionalBooleanInputField) SetValue ¶
func (f *OptionalBooleanInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
type SelectInputField ¶
type SelectInputField struct { // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // Help is the help text of the field. Help string // Options are the options of the field. Errors []string // AllowMultiple is true if the field allows multiple values. AllowMultiple bool // Options are the options of the field. Options []SelectInputFieldOption // Codec is the codec of the field. Codec Codec }
SelectInputField represents a select input field.
func (*SelectInputField) GetErrors ¶
func (f *SelectInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*SelectInputField) GetKind ¶
func (f *SelectInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*SelectInputField) GetName ¶
func (f *SelectInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*SelectInputField) GetStringValue ¶
func (f *SelectInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*SelectInputField) GetValue ¶
func (f *SelectInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*SelectInputField) HasErrors ¶
func (f *SelectInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*SelectInputField) IsSelected ¶
func (f *SelectInputField) IsSelected(value string) bool
func (*SelectInputField) SetErrors ¶
func (f *SelectInputField) SetErrors(errors []string)
SetErrors implements FieldDefinition.SetErrors
func (*SelectInputField) SetStringValue ¶
func (f *SelectInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*SelectInputField) SetValue ¶
func (f *SelectInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
type SelectInputFieldOption ¶
type SelectInputFieldOption struct { // Value is the value of the option. Value string // Label is the label of the option. Label string }
SelectInputFieldOption represents an option of a select input field.
type StringCodec ¶
type StringCodec struct{}
StringCodec is a codec for string values
func (*StringCodec) Decode ¶
func (c *StringCodec) Decode(value string) (interface{}, error)
Decode implements Decoder.Decode
func (*StringCodec) Encode ¶
func (c *StringCodec) Encode(value interface{}) (string, error)
Encode implements Encoder.Encode
type StringListCodec ¶
type StringListCodec struct{}
StringListCodec is a codec for []string values
func (*StringListCodec) Decode ¶
func (c *StringListCodec) Decode(value string) (interface{}, error)
Decode implements Decoder.Decode
func (*StringListCodec) Encode ¶
func (c *StringListCodec) Encode(value interface{}) (string, error)
Encode implements Encoder.Encode
type TextAreaInputField ¶
type TextAreaInputField struct { // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // Help is the help text of the field. Help string // Errors are the errors of the field. Errors []string // Codec is the codec of the field. Codec Codec Rows int }
TextAreaInputField represents a text area input field.
func (*TextAreaInputField) GetErrors ¶
func (f *TextAreaInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*TextAreaInputField) GetKind ¶
func (f *TextAreaInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*TextAreaInputField) GetName ¶
func (f *TextAreaInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*TextAreaInputField) GetStringValue ¶
func (f *TextAreaInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*TextAreaInputField) GetValue ¶
func (f *TextAreaInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*TextAreaInputField) HasErrors ¶
func (f *TextAreaInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*TextAreaInputField) SetErrors ¶
func (f *TextAreaInputField) SetErrors(errors []string)
SetErrors implements FieldDefinition.SetErrors
func (*TextAreaInputField) SetStringValue ¶
func (f *TextAreaInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*TextAreaInputField) SetValue ¶
func (f *TextAreaInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
type TextInputField ¶
type TextInputField struct { // Name is the name of the field. Name string // DisplayName is the display name of the field. DisplayName string // Required is true if the field is required. Required bool // Value is the string value of the field. Value string // Help is the help text of the field. Help string // Errors are the errors of the field. Errors []string // Codec Codec Codec }
TextInputField represents a text input field.
func (*TextInputField) GetErrors ¶
func (f *TextInputField) GetErrors() []string
GetErrors implements FieldDefinition.GetErrors
func (*TextInputField) GetKind ¶
func (f *TextInputField) GetKind() FieldKind
GetKind implements FieldDefinition.GetKind
func (*TextInputField) GetName ¶
func (f *TextInputField) GetName() string
GetName implements FieldDefinition.GetName
func (*TextInputField) GetStringValue ¶
func (f *TextInputField) GetStringValue() string
GetStringValue implements FieldDefinition.GetStringValue
func (*TextInputField) GetValue ¶
func (f *TextInputField) GetValue() (interface{}, error)
GetValue implements InputField.GetValue
func (*TextInputField) HasErrors ¶
func (f *TextInputField) HasErrors() bool
HasErrors implements FieldDefinition.HasErrors
func (*TextInputField) SetErrors ¶
func (f *TextInputField) SetErrors(errors []string)
SetErrors implements FieldDefinition.SetErrors
func (*TextInputField) SetStringValue ¶
func (f *TextInputField) SetStringValue(value string)
SetStringValue implements FieldDefinition.SetStringValue
func (*TextInputField) SetValue ¶
func (f *TextInputField) SetValue(value interface{}) error
SetValue implements InputField.SetValue
Source Files ¶
- codec.go
- codec_bool.go
- codec_int.go
- codec_str.go
- codec_strlist.go
- codec_time.go
- field_input_checkbox.go
- field_input_date.go
- field_input_hidden.go
- field_input_id.go
- field_input_number.go
- field_input_optional_boolean.go
- field_input_select.go
- field_input_text.go
- field_input_textarea.go
- field_kind.go
- forms.go
- interface.go
- render.go