forms

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ArrayIfEmpty  = "array"
	ObjectIfEmpty = "object"
	AbsentIfEmpty = "absent"
	StringType    = "string"
	BoolType      = "bool"
	IntType       = "integer"
	FloatType     = "float"
	PasswordType  = "password"
	ObjectType    = "object"
	ArrayType     = "array"
)

Variables

This section is empty.

Functions

func ProcessBytes

func ProcessBytes(f []byte, env map[string]any) (map[string]any, error)

ProcessBytes treats f as a YAML document and ProcessForm() it

func ProcessFile

func ProcessFile(f string, env map[string]any) (map[string]any, error)

ProcessFile reads f and ProcessForm() it as YAML

func ProcessForm

func ProcessForm(f Form, env map[string]any) (map[string]any, error)

ProcessForm processes the form and return a data structure with the answers

func ProcessReader

func ProcessReader(r io.Reader, env map[string]any) (map[string]any, error)

ProcessReader reads all data from r and ProcessForm() it as YAML

Types

type Form

type Form struct {
	Name        string     `json:"name" yaml:"name"`
	Description string     `json:"description" yaml:"description"`
	Properties  []Property `json:"properties" yaml:"properties"`
}

type Property

type Property struct {
	Name                  string     `json:"name" yaml:"name"`
	Description           string     `json:"description" yaml:"description"`
	Help                  string     `json:"help" yaml:"help"`
	IfEmpty               string     `json:"empty" yaml:"empty"`
	Type                  string     `json:"type" yaml:"type"`
	ConditionalExpression string     `json:"conditional" yaml:"conditional"`
	ValidationExpression  string     `json:"validation" yaml:"validation"`
	Required              bool       `json:"required" yaml:"required"`
	Default               string     `json:"default" yaml:"default"`
	Enum                  []string   `json:"enum" yaml:"enum"`
	Properties            []Property `json:"properties" yaml:"properties"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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