templating

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 18 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 DataSource added in v1.7.0

type DataSource struct {
	SourceType string
	Name       string
	Data       [][]string
}

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 Journal added in v1.8.0

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

type JournalEntry added in v1.8.0

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

type JournalIndex added in v1.8.0

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

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 TemplateDataSource added in v1.7.0

type TemplateDataSource struct {
	DataSources map[string]*DataSource
	RWMutex     sync.RWMutex
}

func NewTemplateDataSource added in v1.7.0

func NewTemplateDataSource() *TemplateDataSource

func (*TemplateDataSource) DeleteDataSource added in v1.7.0

func (templateDataSource *TemplateDataSource) DeleteDataSource(dataSourceName string)

func (*TemplateDataSource) GetAllDataSources added in v1.7.0

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

func (*TemplateDataSource) SetDataSource added in v1.7.0

func (templateDataSource *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{}
	Journal         Journal
	Kvs             map[string]interface{}
}

type Templator added in v0.14.2

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

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, journal *journal.Journal) *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, literals *models.Literals, vars *models.Variables, state map[string]string, journal *journal.Journal) (string, error)

Jump to

Keyboard shortcuts

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