variables

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstantEndpointParameter

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

ConstantEndpointParameter is a parameter that always returns the same value

func (ConstantEndpointParameter) Value

Value always returns the same value

type Definition

type Definition struct {
	Name       string   `toml:"name"`     // Name is the name of the variable
	IsConstant bool     `toml:"constant"` // IsConstant is true if the value of the variable is constant or else false
	Values     []string `toml:"values"`   // Values are all the possible values of the variable (only 1 in case of a constant)
}

Definition describes a variable that should be interpolated in the base url and the query parameters

type EndpointParameter

type EndpointParameter interface {
	Value(index int) any // Value returns the value of the parameter at the given index
}

EndpointParameter is an interface that defines a parameter that will be interpolated as variable in an endpoint request

func NewConstantEndpointParameter

func NewConstantEndpointParameter(value string) EndpointParameter

NewConstantEndpointParameter returns a new EndpointParameter with the given value

func NewVariableEndpointParameter

func NewVariableEndpointParameter(values []string) EndpointParameter

NewVariableEndpointParameter returns a new EndpointParameter with the given values

type VariableEndpointParameter

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

VariableEndpointParameter is a parameter that returns a different value based on the index in the given collection

func (VariableEndpointParameter) Value

func (p VariableEndpointParameter) Value(index int) any

Value returns the value in the initial collection at the given index

type VariableMap

type VariableMap map[string]any

VariableMap is a map of variables that will be generated from a collection of EndpointParameter and will be used when executing the go template

func (VariableMap) Env

func (m VariableMap) Env(key string) string

Env is a function that returns the value of a given environment variable

func (VariableMap) Now

func (m VariableMap) Now(format string) string

Now is a function that returns the current time in the given format (see Time.Format)

Jump to

Keyboard shortcuts

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