Documentation ¶
Index ¶
- Constants
- Variables
- func Build[T any](b *Builder) (T, error)
- func CreateStruct[S, R any](src *S) R
- func CreateValidator[T any](pattern string) func(value ...T) Validator
- func Csrf(name, token string) gox.Node
- func MustBuild[T any](b *Builder) T
- func ParseForm(req *http.Request, limit int) (int, error)
- type Builder
- func (b *Builder) Action(action string) *Builder
- func (b *Builder) Add(name string) *FieldBuilder
- func (b *Builder) Csrf(name, token string) *Builder
- func (b *Builder) Get(name string) *FieldBuilder
- func (b *Builder) Hx() *Builder
- func (b *Builder) Limit(limit int) *Builder
- func (b *Builder) Messages(messages Messages) *Builder
- func (b *Builder) Method(method string) *Builder
- func (b *Builder) Name(name string) *Builder
- func (b *Builder) Request(request *http.Request) *Builder
- func (b *Builder) State(state state) *Builder
- type Config
- type Field
- type FieldBuilder
- func (b *FieldBuilder) Autofocus(autofocus ...bool) *FieldBuilder
- func (b *FieldBuilder) Disabled(disabled ...bool) *FieldBuilder
- func (b *FieldBuilder) Id(id string) *FieldBuilder
- func (b *FieldBuilder) Label(label string) *FieldBuilder
- func (b *FieldBuilder) Multiple(size ...int) *FieldBuilder
- func (b *FieldBuilder) Text(text any) *FieldBuilder
- func (b *FieldBuilder) With(config FieldConfig, validators ...Validator) *FieldBuilder
- type FieldConfig
- func Button(value ...string) FieldConfig
- func Checkbox(value ...bool) FieldConfig
- func Color(value ...string) FieldConfig
- func Date(value ...time.Time) FieldConfig
- func DateTimeLocal(value ...time.Time) FieldConfig
- func Email(value ...string) FieldConfig
- func File(value ...Multipart) FieldConfig
- func Hidden[T comparable](value ...T) FieldConfig
- func Image(value ...string) FieldConfig
- func Month(value ...string) FieldConfig
- func Number[T constraints.Float | constraints.Integer](value ...T) FieldConfig
- func Password(value ...string) FieldConfig
- func Radio(value ...string) FieldConfig
- func Range(value ...string) FieldConfig
- func Reset(value ...string) FieldConfig
- func Search(value ...string) FieldConfig
- func Submit(value ...string) FieldConfig
- func Tel(value ...string) FieldConfig
- func Text(value ...string) FieldConfig
- func Time(value ...time.Time) FieldConfig
- func Url(value ...string) FieldConfig
- func Week(value ...string) FieldConfig
- type Form
- type Messages
- type Multipart
- type Validator
- type Validators
Constants ¶
View Source
const ( CsrfName = "__csrf_name__" CsrfToken = "__csrf_token__" )
View Source
const (
DefaultBodyLimit = 256
)
Variables ¶
View Source
var Validate = Validators{}
Functions ¶
func CreateStruct ¶
func CreateStruct[S, R any](src *S) R
func CreateValidator ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func New ¶
func New(fields ...*FieldBuilder) *Builder
func (*Builder) Add ¶
func (b *Builder) Add(name string) *FieldBuilder
func (*Builder) Get ¶
func (b *Builder) Get(name string) *FieldBuilder
type FieldBuilder ¶
type FieldBuilder struct {
// contains filtered or unexported fields
}
func Add ¶
func Add(name string) *FieldBuilder
func (*FieldBuilder) Autofocus ¶
func (b *FieldBuilder) Autofocus(autofocus ...bool) *FieldBuilder
func (*FieldBuilder) Disabled ¶
func (b *FieldBuilder) Disabled(disabled ...bool) *FieldBuilder
func (*FieldBuilder) Id ¶
func (b *FieldBuilder) Id(id string) *FieldBuilder
func (*FieldBuilder) Label ¶
func (b *FieldBuilder) Label(label string) *FieldBuilder
func (*FieldBuilder) Multiple ¶
func (b *FieldBuilder) Multiple(size ...int) *FieldBuilder
func (*FieldBuilder) Text ¶
func (b *FieldBuilder) Text(text any) *FieldBuilder
func (*FieldBuilder) With ¶
func (b *FieldBuilder) With(config FieldConfig, validators ...Validator) *FieldBuilder
type FieldConfig ¶
type FieldConfig struct {
// contains filtered or unexported fields
}
func Button ¶
func Button(value ...string) FieldConfig
func Checkbox ¶
func Checkbox(value ...bool) FieldConfig
func Color ¶
func Color(value ...string) FieldConfig
func Date ¶
func Date(value ...time.Time) FieldConfig
func DateTimeLocal ¶
func DateTimeLocal(value ...time.Time) FieldConfig
func Email ¶
func Email(value ...string) FieldConfig
func File ¶
func File(value ...Multipart) FieldConfig
func Hidden ¶
func Hidden[T comparable](value ...T) FieldConfig
func Image ¶
func Image(value ...string) FieldConfig
func Month ¶
func Month(value ...string) FieldConfig
func Number ¶
func Number[T constraints.Float | constraints.Integer](value ...T) FieldConfig
func Password ¶
func Password(value ...string) FieldConfig
func Radio ¶
func Radio(value ...string) FieldConfig
func Range ¶
func Range(value ...string) FieldConfig
func Reset ¶
func Reset(value ...string) FieldConfig
func Search ¶
func Search(value ...string) FieldConfig
func Submit ¶
func Submit(value ...string) FieldConfig
func Tel ¶
func Tel(value ...string) FieldConfig
func Text ¶
func Text(value ...string) FieldConfig
func Time ¶
func Time(value ...time.Time) FieldConfig
func Url ¶
func Url(value ...string) FieldConfig
func Week ¶
func Week(value ...string) FieldConfig
type Form ¶
type Messages ¶
type Messages struct { Email string `json:"email" toml:"email" yaml:"email"` Required string `json:"required" toml:"required" yaml:"required"` MinText string `json:"minText" toml:"minText" yaml:"minText"` MaxText string `json:"maxText" toml:"maxText" yaml:"maxText"` MinNumber string `json:"minNumber" toml:"minNumber" yaml:"minNumber"` MaxNumber string `json:"maxNumber" toml:"maxNumber" yaml:"maxNumber"` Multipart string `json:"multipart" toml:"multipart" yaml:"multipart"` Invalid string `json:"invalid" toml:"invalid" yaml:"invalid"` }
type Validators ¶
type Validators struct{}
func (Validators) Email ¶
func (v Validators) Email() Validator
func (Validators) Max ¶
func (v Validators) Max(value int) Validator
func (Validators) Min ¶
func (v Validators) Min(value int) Validator
func (Validators) Required ¶
func (v Validators) Required() Validator
Click to show internal directories.
Click to hide internal directories.