Documentation ¶
Index ¶
- Constants
- type BaseField
- func (bf *BaseField) CleanValue() interface{}
- func (bf *BaseField) Error(errorType string, errorMsg string) *BaseField
- func (bf *BaseField) ErrorMsg() string
- func (bf *BaseField) Field() Field
- func (bf *BaseField) IsValid() bool
- func (bf *BaseField) Max(max int) *BaseField
- func (bf *BaseField) MaxLength(max int) *BaseField
- func (bf *BaseField) Min(min int) *BaseField
- func (bf *BaseField) MinLength(min int) *BaseField
- func (bf *BaseField) Name() string
- func (bf *BaseField) NickName() string
- func (bf *BaseField) Range(min int, max int) *BaseField
- func (bf *BaseField) Required(r bool) *BaseField
- func (bf *BaseField) SetValue(val string)
- func (bf *BaseField) Valid() *ValidResult
- func (bf *BaseField) Value() string
- type CharField
- type EmailField
- type Field
- type FieldOption
- type Form
- type IntegerField
- type RegexpField
- type TextField
- type ValidOption
- type ValidResult
- type Validater
Constants ¶
View Source
const ( MSG_REQUIRED = "this field is required" MSG_MAX_LENGTH = "length must less than {0}" MSG_MIN_LENGTH = "length must more than {0}" MST_RANGE_LENGTH = "length must between {0} and {1}" MSG_MAX = "value must small than {0}" MSG_MIN = "value must large than {0}" MSG_RANGE = "value must between {0} and {1}" MSG_INVALID = "not a valid value" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseField ¶
type BaseField struct {
// contains filtered or unexported fields
}
func (*BaseField) CleanValue ¶
func (bf *BaseField) CleanValue() interface{}
func (*BaseField) Valid ¶
func (bf *BaseField) Valid() *ValidResult
type EmailField ¶
type EmailField struct {
RegexpField
}
func NewEmailField ¶
func NewEmailField(name string, nickname string, required bool) *EmailField
type FieldOption ¶
type Form ¶
func (*Form) CleanValues ¶
CleanValues gets the clean value after validated before you get fm.ClentValues(), you must call fm.Valid() first.
func (*Form) FillByRequest ¶
type IntegerField ¶
type IntegerField struct {
BaseField
}
func NewIntegerField ¶
func NewIntegerField(name string, nickname string, required bool) *IntegerField
type RegexpField ¶
type RegexpField struct { BaseField // contains filtered or unexported fields }
func NewRegexpField ¶
func NewRegexpField(name string, nickname string, required bool, re string) *RegexpField
type ValidOption ¶
type ValidResult ¶
type Validater ¶
type Validater interface {
Valid(source string, option *FieldOption) *ValidResult
}
Click to show internal directories.
Click to hide internal directories.