Documentation ¶
Index ¶
- Variables
- type Store
- func (s *Store) AddValidationError(field string, validationError formulate.ValidationError) error
- func (s *Store) ClearValidationErrors() error
- func (s *Store) GetFormValue(out interface{}) (err error)
- func (s *Store) GetValidationErrors(field string) ([]formulate.ValidationError, error)
- func (s *Store) SetFormValue(i interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidValue = errors.New("sessions: invalid value")
View Source
var ErrValidationErrorTypeAssertionFailed = errors.New("sessions: validation error type assertion failed")
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements formulate.ValidationStore using a combination of both HTTP session and filesystem. ValidationErrors are stored in the HTTP session, but the FormValue is stored in the os.TempDir() in a JSON encoded blob, with the filename formulate_val_* where * is replaced by a random string. The filesystem storage is used as the session storage is limited to 4096 bytes in most browsers.
func NewStore ¶
func NewStore(r *http.Request, w http.ResponseWriter, store sessions.Store, sessionName string) *Store
NewStore creates a session store for saving validation. The sessionName provided must be unique to each form instance.
func (*Store) AddValidationError ¶
func (s *Store) AddValidationError(field string, validationError formulate.ValidationError) error
func (*Store) ClearValidationErrors ¶
func (*Store) GetFormValue ¶
func (*Store) GetValidationErrors ¶
func (s *Store) GetValidationErrors(field string) ([]formulate.ValidationError, error)
func (*Store) SetFormValue ¶
Click to show internal directories.
Click to hide internal directories.