Documentation
¶
Index ¶
- Variables
- func JoinNames(path ...string) string
- func SplitName(name string) []string
- type AnyBinding
- type Binding
- func BindMapKey[T any, K comparable](m map[K]T, key K) *Binding[T]
- func BindNot(b *Binding[bool]) *Binding[bool]
- func BindSliceContainsEl[T comparable](b *Binding[[]T], el T) *Binding[bool]
- func BindSliceEmptyOrSingle[T comparable](b *Binding[[]T], emptyValue T) *Binding[T]
- func Const[T any](value T) *Binding[T]
- func Convert[T, S any](b *Binding[S], stringer func(S) T, convert func(T) (S, error)) *Binding[T]
- func Int64AsString(b *Binding[int64], opts ...any) *Binding[string]
- func IntAsString(b *Binding[int], opts ...any) *Binding[string]
- func Var[T any](ptr *T) *Binding[T]
- func (b *Binding[T]) AsString(stringer func(T) string, convert func(string) (T, error)) *Binding[string]
- func (b *Binding[T]) EnumBindings(f func(AnyBinding))
- func (b *Binding[T]) Init(errs ErrorSite)
- func (b *Binding[T]) Set(value T)
- func (b *Binding[T]) SetString(str string, convert func(string) (T, error))
- func (b *Binding[T]) Validate(validators ...Validator[T]) *Binding[T]
- type Button
- type Checkbox
- type Child
- type Children
- type Container
- type ErrorSite
- type Field
- type FileUpload
- type Form
- type FormData
- type FreeButton
- type Group
- type Header
- type Identity
- type Image
- type InputFloat64
- type InputInt
- type InputInt64
- type InputText
- type InputTime
- type InputWellOpts
- type Item
- type Link
- type List
- func (*List[T]) DefaultTemplate() string
- func (list *List[T]) EnumChildren(f func(Child))
- func (*List[T]) EnumFields(f func(*Field))
- func (list *List[T]) Finalize(state *State)
- func (list *List[T]) FullItemName(item T) string
- func (list *List[T]) Process(fd *FormData)
- func (list *List[T]) RenderInto(buf *strings.Builder, r *Renderer)
- func (list *List[T]) SplitFullItemName(fullName string) (name, typ string)
- type MultiErrorSite
- type Option
- type Processor
- type Renderable
- type Renderer
- func (r *Renderer) Render(item any) template.HTML
- func (r *Renderer) RenderInto(buf *strings.Builder, item any)
- func (r *Renderer) RenderTemplateInto(buf *strings.Builder, templ string, data any)
- func (r *Renderer) RenderWrapperTemplateInto(buf *strings.Builder, templ string, data any, raw template.HTML)
- type Select
- type SingleErrorSite
- type SpecialValue
- type State
- func (st *State) AddField(field *Field)
- func (st *State) AssignIdentity(ident *Identity)
- func (st *State) Classes() map[string]string
- func (st *State) ErrorSite() ErrorSite
- func (st *State) Fin()
- func (st *State) LookupTemplate(templ string) string
- func (st *State) PushClass(key string, value string)
- func (st *State) PushClasses(newClasses map[string]string)
- func (st *State) PushErrorSite(errs ErrorSite)
- func (st *State) PushName(name string)
- func (st *State) PushStyle(s *Style)
- func (st *State) PushStyles(styles []*Style)
- func (st *State) PushTemplate(forTempl, useTempl string)
- func (st *State) PushTemplates(substs []Subst)
- func (st *State) TemplateStyle() TemplateStyle
- type Style
- type Subst
- type TagOpts
- type Template
- type TemplateStyle
- type Templated
- type Text
- type Validator
- type Value
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRequired = errors.New("required")
Functions ¶
Types ¶
type AnyBinding ¶
type AnyBinding interface {
Init(errs ErrorSite)
}
type Binding ¶
type Binding[T any] struct { Value T Setter func(value T) error Validators []Validator[T] ErrSite ErrorSite Child AnyBinding }
func BindMapKey ¶ added in v0.2.0
func BindMapKey[T any, K comparable](m map[K]T, key K) *Binding[T]
func BindSliceContainsEl ¶ added in v0.2.0
func BindSliceContainsEl[T comparable](b *Binding[[]T], el T) *Binding[bool]
func BindSliceEmptyOrSingle ¶ added in v0.2.0
func BindSliceEmptyOrSingle[T comparable](b *Binding[[]T], emptyValue T) *Binding[T]
func Int64AsString ¶ added in v0.2.0
func (*Binding[T]) EnumBindings ¶
func (b *Binding[T]) EnumBindings(f func(AnyBinding))
EnumBindings in Binding simplifies implementation of Processors that embed a Binding.
type Button ¶
type Button struct {
Template
TemplateStyle
Identity
TagOpts
Action string
FullAction string
Activated bool
Title string
}
func (Button) DefaultTemplate ¶
func (*Button) EnumBindings ¶
func (c *Button) EnumBindings(f func(AnyBinding))
type Checkbox ¶
func (Checkbox) DefaultTemplate ¶
type Field ¶
func (*Field) EnumFields ¶
type FileUpload ¶
type FileUpload[T any] struct { Template TemplateStyle Field *Binding[T] Required bool ButtonTitle string ButtonTag TagOpts Handler func(file *multipart.FileHeader) (T, error) }
func (FileUpload[T]) DefaultTemplate ¶
func (FileUpload[T]) DefaultTemplate() string
func (*FileUpload[T]) Finalize ¶
func (c *FileUpload[T]) Finalize(state *State)
func (*FileUpload[T]) Process ¶
func (c *FileUpload[T]) Process(data *FormData)
type Form ¶
type FreeButton ¶
type FreeButton struct {
Template
TemplateStyle
Field
TagOpts
FullAction string
Value string
Title string
}
func (FreeButton) DefaultTemplate ¶
func (FreeButton) DefaultTemplate() string
func (*FreeButton) EnumBindings ¶
func (c *FreeButton) EnumBindings(f func(AnyBinding))
func (*FreeButton) Finalize ¶
func (c *FreeButton) Finalize(state *State)
type Group ¶
type Group struct {
Name string
Title string
WrapperTag TagOpts
Styles []*Style
Template string
TemplateStyle
Options any
Children Children
MultiErrorSite
Form *Form
InnerHTML template.HTML
// contains filtered or unexported fields
}
func (*Group) EnumChildren ¶
type Header ¶
type Header struct {
Template
TemplateStyle
TagOpts
Text string
}
func (Header) DefaultTemplate ¶
type Image ¶
type Image struct {
Template
TemplateStyle
TagOpts
Src string
}
func (Image) DefaultTemplate ¶
type InputFloat64 ¶
type InputFloat64 struct {
Template
TemplateStyle
Field
TagOpts
*Binding[float64]
InputWellOpts
Min float64
Max float64
HasMin bool
HasMax bool
Precision int
}
func (InputFloat64) DefaultTemplate ¶
func (InputFloat64) DefaultTemplate() string
func (*InputFloat64) Finalize ¶
func (c *InputFloat64) Finalize(state *State)
func (*InputFloat64) Process ¶
func (c *InputFloat64) Process(*FormData)
type InputInt ¶
type InputInt struct {
Template
TemplateStyle
Field
TagOpts
*Binding[int]
InputWellOpts
Min int
Max int
Step int
HasMin bool
HasMax bool
}
func (InputInt) DefaultTemplate ¶
type InputInt64 ¶
type InputInt64 struct {
Template
TemplateStyle
Field
TagOpts
*Binding[int64]
InputWellOpts
Min int64
Max int64
HasMin bool
HasMax bool
Step int64
}
func (InputInt64) DefaultTemplate ¶
func (InputInt64) DefaultTemplate() string
func (*InputInt64) Finalize ¶
func (c *InputInt64) Finalize(state *State)
func (*InputInt64) Process ¶
func (c *InputInt64) Process(*FormData)
type InputText ¶
type InputText struct {
Template
TemplateStyle
Field
TagOpts
*Binding[string]
Required bool
MinLen int
MaxLen int
Placeholder string
}
func (InputText) DefaultTemplate ¶
type InputTime ¶ added in v0.2.0
type InputTime struct {
Template
TemplateStyle
Field
TagOpts
*Binding[time.Time]
InputWellOpts
Min time.Time
Max time.Time
Location *time.Location
}
func (InputTime) DefaultTemplate ¶ added in v0.2.0
func (*InputTime) FormattedValue ¶ added in v0.2.0
type InputWellOpts ¶
type Item ¶
type Item struct {
Name string
Identity
Label string
LabelTag TagOpts
ItemTag TagOpts
Styles []*Style
Template string
TemplateStyle
SingleErrorSite
Child Child
Extra Child
InnerHTML template.HTML
ExtraHTML template.HTML
}
func (*Item) EnumChildren ¶
type Link ¶
type Link struct {
Template
TemplateStyle
TagOpts
Link string
}
func (Link) DefaultTemplate ¶
type List ¶ added in v0.2.0
type List[T any] struct { Name string Template string TemplateStyle Identity Styles []*Style WrapperTag TagOpts *Binding[[]T] MinCount int MaxCount int NewItem func(name, typ string) (T, bool) DeleteItem func(item T) ItemName func(item T) string ItemType func(item T) string RenderItem func(item T) *Group Sort func(items []T) Empty Child TopArea func() Children BottomArea func() Children InnerHTML template.HTML // contains filtered or unexported fields }
func (*List[T]) DefaultTemplate ¶ added in v0.2.0
func (*List[T]) EnumChildren ¶ added in v0.2.0
func (*List[T]) EnumFields ¶ added in v0.2.0
func (*List[T]) FullItemName ¶ added in v0.2.0
func (*List[T]) RenderInto ¶ added in v0.2.0
func (*List[T]) SplitFullItemName ¶ added in v0.2.0
type MultiErrorSite ¶
type MultiErrorSite struct {
Errors []error
ParentErrorSite ErrorSite
ErrCount int
CaptureErrors bool
}
func (*MultiErrorSite) AddError ¶
func (errs *MultiErrorSite) AddError(err error)
func (*MultiErrorSite) Init ¶
func (errs *MultiErrorSite) Init(parent ErrorSite)
func (*MultiErrorSite) Invalid ¶
func (errs *MultiErrorSite) Invalid() bool
func (*MultiErrorSite) NoteChildError ¶
func (errs *MultiErrorSite) NoteChildError()
type Option ¶ added in v0.2.0
type Option[T comparable] struct { ModelValue T HTMLValue string Label string }
type Processor ¶
type Processor interface {
Child
EnumFields(f func(*Field))
EnumBindings(f func(AnyBinding))
Process(data *FormData)
}
type Renderer ¶
func (*Renderer) RenderTemplateInto ¶
type Select ¶ added in v0.2.0
type Select[T comparable] struct { Template TemplateStyle Field TagOpts *Binding[T] Required bool Options []*Option[T] }
func (Select[T]) DefaultTemplate ¶ added in v0.2.0
func (*Select[T]) OptionByHTMLValue ¶ added in v0.2.0
func (*Select[T]) OptionByModelValue ¶ added in v0.2.0
type SingleErrorSite ¶
func (*SingleErrorSite) AddError ¶
func (errs *SingleErrorSite) AddError(err error)
func (*SingleErrorSite) Init ¶
func (errs *SingleErrorSite) Init(parent ErrorSite)
func (*SingleErrorSite) Invalid ¶
func (errs *SingleErrorSite) Invalid() bool
func (*SingleErrorSite) NoteChildError ¶
func (errs *SingleErrorSite) NoteChildError()
type SpecialValue ¶ added in v0.2.0
type SpecialValue[T comparable] struct { ModelValue T PostbackValue string }
type State ¶
type State struct {
Data *FormData
// contains filtered or unexported fields
}
func (*State) AssignIdentity ¶
func (*State) LookupTemplate ¶
func (*State) PushClasses ¶
func (*State) PushErrorSite ¶
func (*State) PushStyles ¶
func (*State) PushTemplate ¶
func (*State) PushTemplates ¶
func (*State) TemplateStyle ¶
func (st *State) TemplateStyle() TemplateStyle
type TemplateStyle ¶
func (*TemplateStyle) TemplateStylePtr ¶
func (ts *TemplateStyle) TemplateStylePtr() *TemplateStyle
type Templated ¶
type Templated interface {
Child
TemplateStylePtr() *TemplateStyle
CurrentTemplate() string
DefaultTemplate() string
}
type Text ¶
type Text struct {
Template
TemplateStyle
TagOpts
Text string
}
func (Text) DefaultTemplate ¶
type Wrapper ¶
type Wrapper struct {
WrapperTag TagOpts
Template string
TemplateStyle
Child Child
InnerHTML template.HTML
}
func (*Wrapper) EnumChildren ¶
Click to show internal directories.
Click to hide internal directories.