Documentation ¶
Index ¶
- Constants
- type MapBuilder
- func (b MapBuilder) Get(key string) interface{}
- func (b MapBuilder) GetMap() map[string]interface{}
- func (b MapBuilder) GetString(key string) (string, bool)
- func (b MapBuilder) MarshalJSON() ([]byte, error)
- func (b *MapBuilder) MergeJsonnet(snippet string, reverse bool) error
- func (b *MapBuilder) Set(path string, value interface{}) error
- func (b *MapBuilder) SetMap(body map[string]interface{})
Constants ¶
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) Get ¶
func (b MapBuilder) Get(key string) interface{}
GetMap returns the body as a map[string]interface{}
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) 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) 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