30 lines
504 B
Go
30 lines
504 B
Go
/*
|
|
* SPDX-FileCopyrightText: 2023 jordi fita mas <jfita@peritasoft.com>
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package form
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"net/http"
|
|
"strings"
|
|
)
|
|
|
|
type Input struct {
|
|
Name string
|
|
Val string
|
|
Error error
|
|
}
|
|
|
|
func (input *Input) setError(err error) {
|
|
input.Error = err
|
|
}
|
|
|
|
func (input *Input) FillValue(r *http.Request) {
|
|
input.Val = strings.TrimSpace(r.FormValue(input.Name))
|
|
}
|
|
func (input *Input) Value() (driver.Value, error) {
|
|
return input.Val, nil
|
|
}
|