parser

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigurations

func GetConfigurations(ctx context.Context, input string, fileList []string) (map[string]interface{}, error)

GetConfigurations parses and returns the configurations given in the file list

func ValidInputs

func ValidInputs() []string

ValidInputs returns string array in order to passing valid input types to viper

Types

type ConfigDoc

type ConfigDoc struct {
	ReadCloser io.ReadCloser
	Filepath   string
}

ConfigDoc stores file contents and it's original filename

type ConfigManager

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

ConfigManager the implementation of ReadUnmarshaller and io.Reader byte storage.

func NewConfigManager

func NewConfigManager(fileType string) (*ConfigManager, error)

NewConfigManager is the instatiation function for ConfigManager

func (*ConfigManager) BulkUnmarshal

func (s *ConfigManager) BulkUnmarshal(configList []ConfigDoc) (map[string]interface{}, error)

BulkUnmarshal iterates through the given cached io.Readers and runs the requested parser on the data.

type Parser

type Parser interface {
	Unmarshal(p []byte, v interface{}) error
}

Parser is the interface implemented by objects that can unmarshal bytes into a golang interface

func GetParser

func GetParser(fileType string) (Parser, error)

GetParser gets a parser that works on a given fileType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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