variables

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateGUID

func GenerateGUID() string

GenerateGUID generates a new UUID

func ParseFileVariables

func ParseFileVariables(content string) map[string]string

ParseFileVariables parses file variables from content

Types

type RequestResult

type RequestResult struct {
	StatusCode int
	Headers    map[string][]string
	Body       string
}

RequestResult holds the result of a named request for request variables

type Variable

type Variable struct {
	Name    string
	Value   string
	Type    VariableType
	Error   string
	Warning string
}

Variable represents a resolved variable

type VariableProcessor

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

VariableProcessor processes variables in request content

func NewVariableProcessor

func NewVariableProcessor() *VariableProcessor

NewVariableProcessor creates a new variable processor

func (*VariableProcessor) Process

func (vp *VariableProcessor) Process(text string) (string, error)

Process processes all variables in the given text

func (*VariableProcessor) SetCurrentDir

func (vp *VariableProcessor) SetCurrentDir(dir string)

SetCurrentDir sets the current directory for dotenv resolution

func (*VariableProcessor) SetEnvironment

func (vp *VariableProcessor) SetEnvironment(env string)

SetEnvironment sets the current environment

func (*VariableProcessor) SetEnvironmentVariables

func (vp *VariableProcessor) SetEnvironmentVariables(vars map[string]map[string]string)

SetEnvironmentVariables sets environment variables from config

func (*VariableProcessor) SetFileVariables

func (vp *VariableProcessor) SetFileVariables(vars map[string]string)

SetFileVariables merges file variables into existing ones

func (*VariableProcessor) SetPromptHandler

func (vp *VariableProcessor) SetPromptHandler(handler func(name, description string, isPassword bool) (string, error))

SetPromptHandler sets the handler for prompt variables

func (*VariableProcessor) SetRequestResult

func (vp *VariableProcessor) SetRequestResult(name string, result RequestResult)

SetRequestResult stores a request result for request variables

type VariableProvider

type VariableProvider interface {
	Has(name string) bool
	Get(name string) (*Variable, error)
}

VariableProvider is an interface for variable providers

type VariableType

type VariableType int

VariableType represents the type of variable

const (
	VariableTypeSystem VariableType = iota
	VariableTypeEnvironment
	VariableTypeFile
	VariableTypeRequest
	VariableTypePrompt
)

Jump to

Keyboard shortcuts

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