mapbuilder

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Separator = "."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MapBuilder

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

MapBuilder creates body builder

func NewMapBuilder

func NewMapBuilder() *MapBuilder

func NewMapBuilderFromJSON

func NewMapBuilderFromJSON(data string) (*MapBuilder, error)

NewMapBuilderFromJSON returns a new mapper builder object created from json

func NewMapBuilderFromJsonnetSnippet

func NewMapBuilderFromJsonnetSnippet(snippet string) (*MapBuilder, error)

NewMapBuilderFromJsonnetSnippet returns a new mapper builder from a jsonnet snippet See https://jsonnet.org/learning/tutorial.html for details on how to create a snippet

func NewMapBuilderWithInit

func NewMapBuilderWithInit(body map[string]interface{}) *MapBuilder

func (*MapBuilder) ApplyTemplate added in v1.6.0

func (b *MapBuilder) ApplyTemplate(reverse bool) error

func (MapBuilder) Get

func (b MapBuilder) Get(key string) interface{}

GetMap returns the body as a map[string]interface{}

func (MapBuilder) GetBody added in v1.8.0

func (b MapBuilder) GetBody() (interface{}, error)

func (MapBuilder) GetFileContents added in v1.8.0

func (b MapBuilder) GetFileContents() *os.File

func (MapBuilder) GetMap

func (b MapBuilder) GetMap() map[string]interface{}

GetMap returns the body as a map[string]interface{}

func (MapBuilder) GetString

func (b MapBuilder) GetString(key string) (string, bool)

Get the value as a string

func (*MapBuilder) GetTemplateVariablesJsonnet added in v1.6.0

func (b *MapBuilder) GetTemplateVariablesJsonnet() (string, error)

func (MapBuilder) MarshalJSON

func (b MapBuilder) MarshalJSON() ([]byte, error)

MarshalJSON returns the body as json

func (*MapBuilder) MergeJsonnet

func (b *MapBuilder) MergeJsonnet(snippet string, reverse bool) error

MergeJsonnet merges the existing body data with a given jsonnet snippet. When reverse is false, then the snippet will be applied to the existing data, when reverse is true, then the given snippet will be the base, and the existing data will be applied to the new snippet.

func (*MapBuilder) Set

func (b *MapBuilder) Set(path string, value interface{}) error

Set sets a value to a give dot notation path

func (*MapBuilder) SetFile added in v1.8.0

func (b *MapBuilder) SetFile(path string)

SetFile sets the body to the contents of the file path

func (*MapBuilder) SetMap

func (b *MapBuilder) SetMap(body map[string]interface{})

SetMap sets a new map to the body. This will remove any existing values in the body

func (*MapBuilder) SetRequiredKeys added in v1.6.0

func (b *MapBuilder) SetRequiredKeys(keys ...string)

func (*MapBuilder) SetTemplate added in v1.6.0

func (b *MapBuilder) SetTemplate(template string) *MapBuilder

func (*MapBuilder) SetTemplateVariables added in v1.6.0

func (b *MapBuilder) SetTemplateVariables(variables map[string]interface{})

func (*MapBuilder) SetValidationTemplate added in v1.6.0

func (b *MapBuilder) SetValidationTemplate(template string)

SetValidationTemplate sets the validation template to be applied. The template accepts a jsonnet string

func (MapBuilder) Validate added in v1.6.0

func (b MapBuilder) Validate() error

Validate checks the body if it is valid and contains all of the required keys

Jump to

Keyboard shortcuts

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