templating

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const REQUEST_BODY_HELPER = "requestBody"

Variables

This section is empty.

Functions

func ParseDuration added in v0.17.2

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

Types

type Condition added in v1.10.3

type Condition struct {
	Column   string
	Operator string
	Value    string
}

Condition represents a single condition in the WHERE clause

type DataSource added in v1.7.0

type DataSource struct {
	SourceType string
	Name       string
	Data       [][]string
	// contains filtered or unexported fields
}

func NewCsvDataSource added in v1.7.0

func NewCsvDataSource(fileName, fileContent string) (*DataSource, error)

func (*DataSource) GetDataSourceView added in v1.7.0

func (dataSource *DataSource) GetDataSourceView() (v2.CSVDataSourceView, error)

type Request

type Request struct {
	QueryParam map[string][]string
	Header     map[string][]string
	Path       []string
	Scheme     string
	Body       func(queryType, query string, options *raymond.Options) interface{}
	FormData   map[string][]string

	Method string
	Host   string
	// contains filtered or unexported fields
}

type RowMap added in v1.10.3

type RowMap map[string]string

RowMap represents a single row in the result set

type SQLStatement added in v1.10.3

type SQLStatement struct {
	Type           string // "SELECT", "UPDATE", or "DELETE"
	Columns        []string
	Conditions     []Condition
	SetClauses     map[string]string // For UPDATE queries
	DataSourceName string
}

SQLStatement represents a simple SQL-like query

type TemplateDataSource added in v1.7.0

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

func NewTemplateDataSource added in v1.7.0

func NewTemplateDataSource() *TemplateDataSource

func (*TemplateDataSource) DeleteDataSource added in v1.7.0

func (t *TemplateDataSource) DeleteDataSource(dataSourceName string)

func (*TemplateDataSource) GetAllDataSources added in v1.7.0

func (t *TemplateDataSource) GetAllDataSources() map[string]*DataSource

func (*TemplateDataSource) GetDataSource added in v1.10.3

func (t *TemplateDataSource) GetDataSource(name string) (*DataSource, bool)

func (*TemplateDataSource) SetDataSource added in v1.7.0

func (t *TemplateDataSource) SetDataSource(dataSourceName string, dataSource *DataSource)

type TemplatingData

type TemplatingData struct {
	Request         Request
	State           map[string]string
	CurrentDateTime func(string, string, string) string
	Literals        map[string]interface{}
	Vars            map[string]interface{}
	Kvs             map[string]interface{}
	InternalVars    map[string]interface{} // data store used internally by templating helpers
}

type Templator added in v0.14.2

type Templator struct {
	SupportedMethodMap map[string]interface{}
	TemplateHelper     templateHelpers
}

func NewEnrichedTemplator added in v1.10.3

func NewEnrichedTemplator(journal *journal.Journal) *Templator

func NewTemplator added in v0.14.2

func NewTemplator() *Templator

func (*Templator) GetSupportedMethodMap added in v1.5.0

func (templator *Templator) GetSupportedMethodMap() map[string]interface{}

func (*Templator) NewTemplatingData added in v1.5.0

func (t *Templator) NewTemplatingData(requestDetails *models.RequestDetails, literals *models.Literals, vars *models.Variables, state map[string]string) *TemplatingData

func (*Templator) ParseTemplate added in v1.0.0

func (*Templator) ParseTemplate(responseBody string) (*raymond.Template, error)

func (*Templator) RenderTemplate added in v1.0.0

func (t *Templator) RenderTemplate(tpl *raymond.Template, requestDetails *models.RequestDetails, response *models.ResponseDetails, literals *models.Literals, vars *models.Variables, state map[string]string) (string, error)

func (*Templator) ResetTemplateHelpers added in v1.10.3

func (*Templator) ResetTemplateHelpers()

ResetTemplateHelpers re-register all the helpers, this is useful for testing when we initialize the templator on every test, and they need a fresh copy of the data source in templatingHelpers

Jump to

Keyboard shortcuts

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