helpers

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFromBash

func LoadFromBash(args []string) (string, cue.Value, error)

func LoadFromFile

func LoadFromFile(filename string) (string, cue.Value, error)

func LoadFromHttp

func LoadFromHttp(fullurl string) (string, cue.Value, error)

func LoadFromText

func LoadFromText(content string) (string, cue.Value, error)

func LoadRuntime

func LoadRuntime(args []string) (*runtime.Runtime, error)

Types

type EvalSource

type EvalSource string
const (
	EvalNone    EvalSource = ""
	EvalRuntime EvalSource = "runtime"
	EvalText    EvalSource = "text"
	EvalFile    EvalSource = "file"
	EvalBash    EvalSource = "bash"
	EvalHttp    EvalSource = "http"
	EvalConn    EvalSource = "conn"
)

type SourceConfig

type SourceConfig struct {
	Name string

	// manual source data
	Value cue.Value
	Error error
	Text  string

	// or how to get the value
	Source EvalSource
	Args   []string

	// Path to fill the CUE value
	// (when used as an input in browser)
	// this will be filled at Path in another value there
	Path string

	ConnGetter func() cue.Value

	// for handling external changes and updating the Value
	WatchGlobs []string
	WatchTime  time.Duration
	WatchQuit  chan bool
	WatchFunc  func()
	// contains filtered or unexported fields
}

func CreateFrom

func CreateFrom(args []string, context map[string]any) (*SourceConfig, error)

func (*SourceConfig) Decode

func (sc *SourceConfig) Decode(input map[string]any) (*SourceConfig, error)

func (*SourceConfig) Encode

func (sc *SourceConfig) Encode() (map[string]any, error)

func (*SourceConfig) GetText

func (sc *SourceConfig) GetText() (string, error)

func (*SourceConfig) GetValue

func (sc *SourceConfig) GetValue() (cue.Value, error)

func (*SourceConfig) StopWatch

func (sc *SourceConfig) StopWatch()

func (*SourceConfig) UpdateFrom

func (sc *SourceConfig) UpdateFrom(action string, args []string, context map[string]any) (bool, error)

func (*SourceConfig) Watch

func (sc *SourceConfig) Watch()

Jump to

Keyboard shortcuts

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