doc: add documentation of functions and licence

This commit is contained in:
Simon Vieille 2025-10-01 23:30:16 +02:00
commit f451d69d70
Signed by: deblan
GPG key ID: 579388D585F70417
5 changed files with 38 additions and 5 deletions

View file

@ -158,6 +158,7 @@ func (f *Field) WithOptions(options ...*Option) *Field {
return f
}
// Remove an option if exists
func (f *Field) RemoveOption(name string) *Field {
var options []*Option
@ -377,6 +378,7 @@ func (f *Field) Bind(data map[string]any, key *string, parentIsSlice bool) error
return nil
}
// Generates a tree of errors
func (f *Field) ErrorsTree(tree map[string]any, key *string) {
var index string

View file

@ -1,10 +1,5 @@
package form
import (
"fmt"
"reflect"
)
// @license GNU AGPL version 3 or any later version
//
// This program is free software: you can redistribute it and/or modify
@ -20,6 +15,11 @@ import (
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import (
"fmt"
"reflect"
)
// Generates a sub form
func NewFieldCollection(name string) *Field {
f := NewField(name, "collection").

View file

@ -293,6 +293,7 @@ func (f *Form) IsSubmitted() bool {
return f.RequestData != nil
}
// Generates a tree of errors
func (f *Form) ErrorsTree() map[string]any {
errors := make(map[string]any)

View file

@ -1,5 +1,20 @@
package util
// @license GNU AGPL version 3 or any later version
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import (
"regexp"
"strings"

View file

@ -1,5 +1,20 @@
package util
// @license GNU AGPL version 3 or any later version
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import (
"fmt"
"net/url"