parsers

package
v0.0.0-...-e7fc6ae Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEnvironment

func ParseEnvironment(content []byte) ([]byte, error)

ParseEnvironment parses the content of a configuration file and replaces placeholders for environment variables with the value from the OS, or uses the default-value if the environment variable isn't set.

ParseEnvironment looks for the following patterns:

${MY_ENV}
${MY_ENV:defaultValue}

If a default value is not provided and an environment variable is not set an error will be returned.

Types

type BSON

type BSON struct{}

BSON is a koanf.Parser for encoding/decoding BSON data.

func BsonParser

func BsonParser() *BSON

BsonParser returns a koanf.Parser for BSON data

func (BSON) Marshal

func (B BSON) Marshal(m map[string]interface{}) ([]byte, error)

func (BSON) Unmarshal

func (B BSON) Unmarshal(bytes []byte) (map[string]interface{}, error)

type JSON

type JSON struct{}

JSON is a koanf.Parser for encoding/decoding JSON data.

func JsonParser

func JsonParser() *JSON

JsonParser returns a koanf.Parser for JSON data

func (*JSON) Marshal

func (J *JSON) Marshal(m map[string]interface{}) ([]byte, error)

func (*JSON) Unmarshal

func (J *JSON) Unmarshal(bytes []byte) (map[string]interface{}, error)

type Toml

type Toml struct{}

Toml is a koanf.Parser for encoding/decoding Toml files.

func TomlParser

func TomlParser() *Toml

TomlParser returns a koanf.Parser for TOML data

func (*Toml) Marshal

func (t *Toml) Marshal(m map[string]interface{}) ([]byte, error)

func (*Toml) Unmarshal

func (t *Toml) Unmarshal(bytes []byte) (map[string]interface{}, error)

type Yaml

type Yaml struct{}

Yaml is a koanf.Parser for encoding/decoding yaml data.

func YamlParser

func YamlParser() *Yaml

YamlParser returns a koanf.Parser for YAML data

func (*Yaml) Marshal

func (y *Yaml) Marshal(m map[string]interface{}) ([]byte, error)

func (*Yaml) Unmarshal

func (y *Yaml) Unmarshal(bytes []byte) (map[string]interface{}, error)

Directories

Path Synopsis
env module
yaml module

Jump to

Keyboard shortcuts

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