fileloader

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.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 FileLoader

type FileLoader interface {
	LoadFile(filePath string) ([]map[string]interface{}, error)
	SupportedFileExtensions() []string
}

FileLoader is the interface that wraps LoadFile and SupportedFileExtensions methods

LoadFile loads file from given path. It returns file content as map[string]interface{} and any error encountered that caused the file loading to stop early.

SupportedFileExtensions returns a slice of strings representing supported file format extensions

type JSONLoader

type JSONLoader struct{}

JSONLoader load JSON files

func NewJSONLoader

func NewJSONLoader() *JSONLoader

NewJSONLoader create loader that can load JSON files with extension ".json"

func (*JSONLoader) LoadFile

func (jl *JSONLoader) LoadFile(filePath string) ([]map[string]interface{}, error)

LoadFile load file

func (*JSONLoader) SupportedFileExtensions

func (jl *JSONLoader) SupportedFileExtensions() []string

SupportedFileExtensions get supported file extensions

type JsonnetLoader

type JsonnetLoader struct {
	*jsonnet.VM
}

JsonnetLoader load jsonnet files

func NewJsonnetLoader

func NewJsonnetLoader(librariesPaths ...string) *JsonnetLoader

NewJsonnetLoader create loader

func (*JsonnetLoader) LoadFile

func (jl *JsonnetLoader) LoadFile(filePath string) ([]map[string]interface{}, error)

LoadFile load file

func (*JsonnetLoader) SupportedFileExtensions

func (jl *JsonnetLoader) SupportedFileExtensions() []string

SupportedFileExtensions get list of supported file extensions

type YAMLLoader

type YAMLLoader struct{}

YAMLLoader load YAML files

func NewYAMLLoader

func NewYAMLLoader() *YAMLLoader

NewYAMLLoader create new YAML file loader

func (*YAMLLoader) LoadFile

func (yl *YAMLLoader) LoadFile(filePath string) ([]map[string]interface{}, error)

LoadFile load file

func (*YAMLLoader) SupportedFileExtensions

func (yl *YAMLLoader) SupportedFileExtensions() []string

SupportedFileExtensions get supported file extensions

Jump to

Keyboard shortcuts

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