gohelpgabs

package module
v0.0.0-...-051700e Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	*gabs.Container
	// contains filtered or unexported fields
}

Container encapsulates gabs.Container

func New

func New() *Container

New - Create a new gohelpgabs JSON object.

func ParseJSON

func ParseJSON(sample []byte) (container *Container, err error)

ParseJSON parses a string into a representation of the parsed JSON in gabs and returns our container

func (*Container) ArrayAppendOrCreate

func (container *Container) ArrayAppendOrCreate(value interface{}, path ...string) (err error)

ArrayAppendOrCreate - Append a value onto a JSON array or create one with the provided value if the array does not yet exists.

func (*Container) ArrayAppendOrCreateP

func (container *Container) ArrayAppendOrCreateP(value interface{}, path string) error

ArrayAppendOrCreateP - Append a value onto a JSON array using a dot notation JSON path or create one with the provided value if the array does not yet exists.

func (*Container) GetMissingPaths

func (container *Container) GetMissingPaths(paths ...string) (missingPaths []string)

GetMissingPaths returns a list of specified paths not found in the specified container

func (*Container) LogAndSetError

func (container *Container) LogAndSetError(format string, a ...interface{})

LogAndSetError - Formats the message, log it and appends to the container's error path

func (*Container) PopPath

func (container *Container) PopPath(path string) *Container

PopPath will search the Path for the value then delete it if it exists

func (*Container) Search

func (container *Container) Search(hierarchy ...string) *Container

Search - Attempt to find and return an object within the JSON structure by specifying the hierarchy of field names to locate the target. If the search encounters an array and has not reached the end target then it will iterate each object of the array for the target and return all of the results in a JSON array.

func (*Container) SetValueIfPathExists

func (container *Container) SetValueIfPathExists(path string, value interface{})

SetValueIfPathExists sets the value to the specified path if it exists

Jump to

Keyboard shortcuts

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