Parses form data from HTTP requests to model data via the overloadable toModelValue proc.
Procs
proc parseFormData[T: Model](ctx: Context; model: typedesc[T]; skipIdField: static bool = false): T
- Parses form data from an HTTP request body in ctx into a model instance of the specified model type. Allows skipping setting the id field when the formData can not contain an id, e.g. when a model gets created. Source Edit
func toModelValue(formValue: string; T: typedesc[bool]): T:type
- Converts an HTML form value in string format to a boolean Source Edit
proc toModelValue(formValue: string; T: typedesc[DateTime]): T:type
- Converts an HTML form value in string format to a DateTime instance Source Edit
func toModelValue(formValue: string; T: typedesc[SomeFloat]): T:type
- Converts an HTML form value in string format to a float Source Edit
func toModelValue(formValue: string; T: typedesc[SomeInteger]): T:type
- Converts an HTML form value in string format to an integer Source Edit
func toModelValue(formValue: string; T: typedesc[string]): T:type
- Converts an HTML form value in string format to a string This essentially does nothing and exists just to handle strings. Source Edit
func toModelValue[T: enum](formValue: string; O: typedesc[T]): T
- Converts an HTML form value in string format to an int value or a distinct int type Source Edit
func toModelValue[T](formValue: string; O: typedesc[Option[T]]): O:type
- Converts an HTML form value in string format to an an optional value. Empty strings get counted as non-existant values. Source Edit