helpers

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallFunctionFromJson added in v0.2.24

func CallFunctionFromJson(f Callable, jsonArgs interface{}) ([]reflect.Value, error)

CallFunctionFromJson calls a function with arguments provided as JSON TODO(manuel, 2024-01-12) make this take a ctx

func FillStructFromKV added in v0.1.9

func FillStructFromKV(kv map[string]string, v interface{}) error

func GetFunctionParametersJsonSchema added in v0.2.24

func GetFunctionParametersJsonSchema(reflector *jsonschema.Reflector, f Callable) (*jsonschema.Schema, error)

GetFunctionParametersJsonSchema generates a JSON Schema for the arguments of the given function

func ParseKV added in v0.1.9

func ParseKV(s string) map[string]string

ParseKV transforms a simple format. Each line has a key value pair separated by :. Empty lines are ignored

Types

type Callable added in v0.2.24

type Callable interface{}

Callable is a type representing any callable function

type Nothing

type Nothing struct{}

type Result

type Result[T any] struct {
	// contains filtered or unexported fields
}

func NewErrorResult

func NewErrorResult[T any](err error) Result[T]

func NewResult

func NewResult[T any](value T, err error) Result[T]

func NewValueResult

func NewValueResult[T any](value T) Result[T]

func (Result[T]) Error added in v0.1.18

func (r Result[T]) Error() error

func (Result[T]) Ok

func (r Result[T]) Ok() bool

func (Result[T]) Unwrap

func (r Result[T]) Unwrap() T

func (Result[T]) Value

func (r Result[T]) Value() (T, error)

func (Result[T]) ValueOr

func (r Result[T]) ValueOr(v T) T

Jump to

Keyboard shortcuts

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