forms

package module
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolFormatter

func BoolFormatter(v reflect.Value) string

func IdFormatter

func IdFormatter(v reflect.Value) string

func IntFormatter

func IntFormatter(v reflect.Value) string

func StringFormatter

func StringFormatter(v reflect.Value) string

func StringSliceFormatter

func StringSliceFormatter(v reflect.Value) string

Types

type Component

type Component func(name, label, value string) *bolt.Field

type FieldConfig

type FieldConfig struct {
	// contains filtered or unexported fields
}

func (*FieldConfig) Component

func (c *FieldConfig) Component(component Component)

func (*FieldConfig) Formatter

func (c *FieldConfig) Formatter(formatter Formatter)

func (*FieldConfig) Label

func (c *FieldConfig) Label(label string)

func (*FieldConfig) Name

func (c *FieldConfig) Name(name string)

type Formatter

type Formatter func(value reflect.Value) string

type Model

type Model struct {
	hound.Model `bson:",inline"`
	Theme       *Theme `json:"-" bson:"-"`
	// contains filtered or unexported fields
}

func NewModel

func NewModel(collectionName string, id ...string) Model

func (*Model) Element

func (m *Model) Element(name ...string) bolt.Element

func (*Model) Field

func (m *Model) Field(name string, obj any, theme ...*Theme) *bolt.Field

func (*Model) FieldConfig

func (m *Model) FieldConfig(name string) *FieldConfig
func (m *Model) UseComponent(fieldType string, component Component) {
	m.Theme[fieldType] = component
}

func (*Model) Form

func (m *Model) Form(s any, prefix string, theme ...*Theme) bolt.Element

type RenderMethod

type RenderMethod string
const (
	RenderByName      RenderMethod = "RenderByName"
	RenderByFieldType RenderMethod = "RenderByFieldType"
	RenderByDataType  RenderMethod = "RenderByDataType"
)

func (RenderMethod) String

func (m RenderMethod) String() string

type Theme added in v0.0.8

type Theme struct {
	// contains filtered or unexported fields
}

func NewTheme added in v0.0.8

func NewTheme(defaultComponent Component) *Theme

func (*Theme) DataType added in v0.0.8

func (t *Theme) DataType(dataType string, component Component) *Theme

func (*Theme) FieldName added in v0.0.8

func (t *Theme) FieldName(fieldName string, component Component) *Theme

func (*Theme) FieldType added in v0.0.8

func (t *Theme) FieldType(fieldType string, component Component) *Theme

func (*Theme) GetComponent added in v0.0.8

func (t *Theme) GetComponent(meta reflect.StructField) Component

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL