spiff

package
v0.0.0-...-877fc11 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cascade

func Cascade(req *Request) ([]byte, error)

func CascadeWith

func CascadeWith(opts ...Option) ([]byte, error)

func ValidateByScheme

func ValidateByScheme(src []byte, schemedata []byte) error

func ValidateSourceByScheme

func ValidateSourceByScheme(src spiffing.Source, schemedata []byte) error

Types

type Option

type Option interface {
	ApplyToRequest(r *Request) error
}

func Validated

func Validated(schemedata []byte, opts ...Option) Option

type OptionFunction

type OptionFunction func(r *Request) error

func Context

func Context(ctx datacontext.Context) OptionFunction

func FileSystem

func FileSystem(fs vfs.FileSystem) OptionFunction

func Functions

func Functions(functions spiffing.Functions) OptionFunction

func Mode

func Mode(m int) OptionFunction

func StubData

func StubData(name string, data []byte) OptionFunction

func StubFile

func StubFile(path string, fss ...vfs.FileSystem) OptionFunction

func TemplateData

func TemplateData(name string, data []byte) OptionFunction

func TemplateFile

func TemplateFile(path string, fss ...vfs.FileSystem) OptionFunction

func Values

func Values(values interface{}) OptionFunction

func ValuesNode

func ValuesNode(values string) OptionFunction

func WorkDir

func WorkDir(path string) OptionFunction

func (OptionFunction) ApplyToRequest

func (f OptionFunction) ApplyToRequest(r *Request) error

type Options

type Options []Option

func (*Options) Add

func (o *Options) Add(opt Option) *Options

func (Options) ApplyToRequest

func (o Options) ApplyToRequest(r *Request) error

type Request

type Request struct {
	Template   spiffing.Source
	Stubs      []spiffing.Source
	ValuesNode string
	Values     interface{}
	Mode       int
	FileSystem vfs.FileSystem
	Functions  spiffing.Functions
}

func GetRequest

func GetRequest(opts ...Option) (*Request, error)

func (*Request) GetSpiff

func (r *Request) GetSpiff() (spiffing.Spiff, error)

func (Request) GetValues

func (r Request) GetValues() (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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