form

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMapInterfaceOrJSON = errors.New("param must be either a json string or a map[string]interface{}")
	ErrParamsMissing      = errors.New("param cannot be nil")
)

Functions

func CompName

func CompName(comp map[string]interface{}) (string, bool)

func CompValidate

func CompValidate(comp map[string]interface{}) (validate.Rules, bool)

func ComponentsFrom

func ComponentsFrom(formSrc map[string]interface{}) map[string]interface{}

func GenericLoop

func GenericLoop(m interface{}, f func(int, interface{}) bool) bool

GenericLoop executes a function on elements of a slice or array

func GetFormSrc

func GetFormSrc(formSrc interface{}) map[string]interface{}

func IsCompVisible

func IsCompVisible(formInput map[string]interface{}, comps, compMain map[string]interface{}, destCompID string) bool

func LoopComponents

func LoopComponents(formSrc interface{}, looper func(compId, compInstId string, compMain interface{}, comp map[string]interface{}) bool)

func NewDataManager

func NewDataManager(baseFilePath string) *dataManager

func RulesOf

func RulesOf(formSrc interface{}, fieldName string) (vRules validate.Rules)

func Validate

func Validate(formInput map[string]interface{}, spec interface{}, submit bool) (validate.ErrorMap, error)

func ValidateFile

func ValidateFile(src io.Reader, formSrc interface{}, fieldName string) ([]byte, error)

func Vars

func Vars(formSrc interface{}) []string

Types

type DataManager

type DataManager interface {
	OnLoad()
	GetDataFile(formID, name string) (*file.IO, error)
	GetData(formID string) (map[string]interface{}, error)
	GetDataByPath(formID, dataPath string) (interface{}, error)
	Clear(formID string) error
	GetAllData() (dat map[string]interface{}, err error)
	GetAllDataFilePathNameOnly() (dat map[string]interface{}, files []string)
	PutData(formID string, dat map[string]interface{}) error
	PutDataWithoutMerge(formID string, dat map[string]interface{}) error
	PutDataFile(db storage.FilesIF, formID, name string, f file.Meta, reader io.Reader) error
	Close() (err error)
}

type JSRegexEval

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

TODO improve/replace js engine

func NewJSRegexEval

func NewJSRegexEval() *JSRegexEval

var tmpVm *goja.Runtime

func (*JSRegexEval) Close

func (js *JSRegexEval) Close()

func (*JSRegexEval) Test

func (js *JSRegexEval) Test(regex, val string) bool

Jump to

Keyboard shortcuts

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