formatter

package
v0.0.0-...-27c9e6d Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	String = "string"
	Int    = "int"
	Bool   = "bool"
	Array  = "array"
)
View Source
const DirectValue = "direct_value"

Variables

View Source
var ErrFuncNotFound = fmt.Errorf("function not found")
View Source
var ErrInvalidInput = errors.New("invalid input error")

Functions

func GetFuncs

func GetFuncs() map[string]FormatFunc

func ToString

func ToString(args ...interface{}) (string, error)

func ToUpper

func ToUpper(args ...interface{}) (string, error)

Types

type Arg

type Arg struct {
	Name      string      `json:"name"`
	Type      string      `json:"type"`
	Source    string      `json:"source"`
	Key       string      `json:"key"`
	Value     interface{} `json:"value"`
	NestedKey string      `json:"nestedKey"`
	FuncName  string      `json:"funcName"`
}

type FormatFunc

type FormatFunc struct {
	Inputs      []string `json:"inputs"`
	Output      string   `json:"output"`
	Description string   `json:"description"`
	// contains filtered or unexported fields
}

type Formatter

type Formatter struct {
	FormatStr string              `json:"format_str"`
	FuncCalls map[string]FuncCall `json:"func_calls"`
}

func (*Formatter) Format

func (f *Formatter) Format(values map[string]interface{}) (string, error)

func (*Formatter) GetArgs

func (f *Formatter) GetArgs() []Arg

type FuncCall

type FuncCall struct {
	Func   string `json:"function"`
	Args   []Arg  `json:"args"`
	Result string `json:"result"`
}

Jump to

Keyboard shortcuts

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