contexts

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fakes = GetFakes()

Fakes is a map of registered fake functions.

Functions

func CollectContexts

func CollectContexts(names []map[string]string, fileCollections map[string]map[string]any,
	initial map[string]any) []map[string]any

CollectContexts collects contexts from the given list of context names, file collections and initial context.

func GetFakeFuncFactoryWithString

func GetFakeFuncFactoryWithString() map[string]FakeFuncFactoryWithString

GetFakeFuncFactoryWithString returns a map of utility fake functions.

func GetFakes

func GetFakes() map[string]FakeFunc

GetFakes returns a map of fake functions from underlying fake library by gathering all exported methods from the faker.Faker struct into map. The keys are the snake_cased dot-separated method names, which reflect the location of the function: For example: person.first_name will return a fake first name from the Person struct.

Types

type BoolValue

type BoolValue bool

func (BoolValue) Get

func (b BoolValue) Get() any

type FakeFunc

type FakeFunc func() MixedValue

FakeFunc is a function that returns a MixedValue. This is u unified way to work with different return types from fake library.

type FakeFuncFactoryWithString

type FakeFuncFactoryWithString func(value string) FakeFunc

FakeFuncFactoryWithString is a function that returns a FakeFunc.

type Float64Value

type Float64Value float64

func (Float64Value) Get

func (f Float64Value) Get() any

type IntValue

type IntValue int

func (IntValue) Get

func (i IntValue) Get() any

type MixedValue

type MixedValue interface {
	Get() any
}

MixedValue is a value that can represent string, int, float64, or bool type.

type ParsedContextResult

type ParsedContextResult struct {
	Result  map[string]any
	Aliases map[string]string
}

ParsedContextResult is the result of parsing a context file.

func ParseContextFile

func ParseContextFile(filePath string, fakes map[string]FakeFunc) (*ParsedContextResult, error)

ParseContextFile parses a YAML file and returns a map of context properties. Filename without extension is used as the context namespace and can be referenced: - in service config - when creating aliases

func ParseContextFromBytes

func ParseContextFromBytes(content []byte, fakes map[string]FakeFunc) (*ParsedContextResult, error)

ParseContextFromBytes byte contents from the YAML file and returns a map of context properties.

type StringValue

type StringValue string

func (StringValue) Get

func (s StringValue) Get() any

Jump to

Keyboard shortcuts

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