pageform

package
v0.0.0-...-8c2001a Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBuilder

func NewBuilder(app any) (etypes.ExecutorBuilder, error)

func RegisterHookFunc

func RegisterHookFunc(name string, hfunc HookFunc)

Types

type FormItem

type FormItem struct {
	Name     string            `json:"name,omitempty" yaml:"name,omitempty"`
	Info     string            `json:"info,omitempty" yaml:"info,omitempty"`
	Type     string            `json:"type,omitempty" yaml:"type,omitempty"`
	Options  []string          `json:"options,omitempty" yaml:"options,omitempty"`
	Pattern  string            `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	HtmlAttr map[string]string `json:"html_attr,omitempty" yaml:"html_attr,omitempty"`
	Disabled bool              `json:"disabled,omitempty" yaml:"disabled,omitempty"`
}

type FormModel

type FormModel struct {
	Name     string               `json:"name,omitempty" yaml:"name,omitempty"`
	Stages   map[string]FormStage `json:"stages,omitempty" yaml:"stages,omitempty"`
	ExecHint []string             `json:"exec_hint,omitempty" yaml:"exec_hint,omitempty"`
	OnLoad   []Hook               `json:"on_load,omitempty" yaml:"on_load,omitempty"`
}

type FormStage

type FormStage struct {
	About    string         `json:"about,omitempty" yaml:"about,omitempty"`
	Items    []FormItem     `json:"items,omitempty" yaml:"items,omitempty"`
	OnSubmit []Hook         `json:"on_submit,omitempty" yaml:"on_submit,omitempty"` // validate data -> side_effect -> maybe_modify_data -> set_next_stage
	OnBuild  []Hook         `json:"on_build,omitempty" yaml:"on_build,omitempty"`   // load_fileds -> set_data
	Data     map[string]any `json:"data,omitempty" yaml:"data,omitempty"`
}

func (*FormStage) GetItems

func (fs *FormStage) GetItems(ignores []string) []FormItem

type Hook

type Hook struct {
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
	Target  string `json:"target,omitempty" yaml:"target,omitempty"`
	Type    string `json:"type,omitempty" yaml:"type,omitempty"`
	Options string `json:"options,omitempty" yaml:"options,omitempty"`
}

type HookFunc

type HookFunc func(ctx *PfCtx) error

type LoadRequest

type LoadRequest struct {
	DataContextType string         `json:"data_context_type,omitempty" yaml:"data_context_type,omitempty"`
	Rows            []int64        `json:"rows,omitempty" yaml:"rows,omitempty"`
	Options         map[string]any `json:"options,omitempty" yaml:"options,omitempty"`
}

type Pageform

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

func (*Pageform) Process

func (pf *Pageform) Process(ev *event.Request) (*event.Response, error)

type PfBuilder

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

func (*PfBuilder) ExecFile

func (pf *PfBuilder) ExecFile(file string) ([]byte, error)

func (*PfBuilder) IfaceFile

func (pf *PfBuilder) IfaceFile() (*etypes.ExecutorIface, error)

func (*PfBuilder) Instance

func (pf *PfBuilder) Instance(opts etypes.ExecutorOption) (etypes.Executor, error)

type PfCtx

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

type Response

type Response struct {
	Title   string         `json:"title,omitempty" yaml:"title,omitempty"`
	Ok      bool           `json:"ok,omitempty" yaml:"ok,omitempty"`
	Final   bool           `json:"final,omitempty" yaml:"final,omitempty"`
	Message string         `json:"message,omitempty" yaml:"message,omitempty"`
	Items   []FormItem     `json:"items,omitempty" yaml:"items,omitempty"`
	Data    map[string]any `json:"data,omitempty" yaml:"data,omitempty"`
	Stage   string         `json:"stage,omitempty" yaml:"stage,omitempty"`
}

type SubmitRequest

type SubmitRequest struct {
	Data  map[string]any `json:"data,omitempty" yaml:"data,omitempty"`
	Stage string         `json:"stage,omitempty" yaml:"stage,omitempty"`
}

Jump to

Keyboard shortcuts

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