util

package
v0.0.0-...-b41ccf1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeYAMLLibObject

func DecodeYAMLLibObject(yamlData interface{}) interface{}

DecodeYAMLLibObject decodes interface format yaml.v2 lib returns map as map[interface{}]interface{} while gohan lib uses map[string]interface{} so we need to convert it here

func ExitFatal

func ExitFatal(a ...interface{})

ExitFatal ...

func ExitFatalf

func ExitFatalf(format string, a ...interface{})

ExitFatalf ...

func GetByJSONPointer

func GetByJSONPointer(inData interface{}, key string) (interface{}, error)

GetByJSONPointer returns subdata of json using json pointer

func GetContent

func GetContent(url string) ([]byte, error)

GetContent loads file from remote or local

func GetEnvMap

func GetEnvMap() map[string]string

GetEnvMap reads environemnt vars and return key value

func GetSortedKeys

func GetSortedKeys(object map[string]interface{}) []string

GetSortedKeys returns sorted keys of map[string]interface{}

func LoadFile

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

LoadFile loads object from file. suffix of filepath will be used as file type. currently, json and yaml is supported

func LoadTemplate

func LoadTemplate(filePath string, params interface{}) (map[string]interface{}, error)

LoadTemplate loads object from file. suffix of filepath will be used as file type. currently, json and yaml is supported

func MatchAsJSON

func MatchAsJSON(expected interface{}) types.GomegaMatcher

MatchAsJSON checks whether the provided arguments are equivalent after being marshalled as JSONs

func PublicKeyFile

func PublicKeyFile(file string) ssh.AuthMethod

PublicKeyFile read file and return ssh public keys

func SaveFile

func SaveFile(file string, data interface{}) error

SaveFile saves object to file. suffix of filepath will be used as file type. currently, json and yaml is supported

func TempFile

func TempFile(dir string, prefix string, suffix string) (*os.File, error)

TempFile creates a temporary file with the specified prefix and suffix

Types

type Config

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

Config stores configuration paramters for api server

func GetConfig

func GetConfig() *Config

GetConfig returns configuraion data

func (*Config) GetBool

func (config *Config) GetBool(key string, defaultValue bool) bool

GetBool returns string parameter from config

func (*Config) GetList

func (config *Config) GetList(key string, defaultValue []interface{}) []interface{}

GetList returns list parameter from config

func (*Config) GetParam

func (config *Config) GetParam(key string, defaultValue interface{}) interface{}

GetParam returns parameter from config

func (*Config) GetString

func (config *Config) GetString(key, defaultValue string) string

GetString returns string parameter from config

func (*Config) GetStringList

func (config *Config) GetStringList(key string, defaultValue []string) []string

GetStringList returns string list parameter from config

func (*Config) ReadConfig

func (config *Config) ReadConfig(path string) error

ReadConfig reads data from config file Config file can be yaml or json file

Jump to

Keyboard shortcuts

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