data

package
v0.0.0-...-d0f74d3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package data contins data substitution routines.

Package data contains the data substitution module

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context defines a sequence

func New

func New() *Context

New creates a new context instance

func (*Context) AddReplacement

func (d *Context) AddReplacement(name string, value string) error

AddReplacement creates a new regex replacement.

func (*Context) ExtractJSON

func (d *Context) ExtractJSON(path string, r io.Reader) (string, error)

ExtractJSON extracts a value using a gjson path.

func (*Context) ExtractRegex

func (d *Context) ExtractRegex(rs string, r io.Reader) (string, error)

ExtractRegex extracts a value using a regular expression.

func (*Context) ExtractXML

func (d *Context) ExtractXML(path string, r io.Reader) (string, error)

ExtractXML saves a datum from the specified XPath.

func (*Context) Len

func (d *Context) Len() int

Len returns the number of replacement elements.

func (*Context) Lookup

func (d *Context) Lookup(n string) string

Lookup returns the reaplcement text (value) for a name

func (*Context) Replace

func (d *Context) Replace(s string) string

Replace replaces any matches and returns a new string

type Data

type Data interface {
	AddReplacement(string, string) error
	Replace(string) string
	Lookup(string) string
	Len() int
	ExtractJSON(string, io.Reader) (string, error)
	ExtractXML(string, io.Reader) (string, error)
	ExtractRegex(string, io.Reader) (string, error)
}

Data defines interfaces for executing scenarios

type Replacement

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

Replacement defines a compiled regex and its associated replacement string

Jump to

Keyboard shortcuts

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