envconv

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

package envconv contains functionality for converting between data types commonly used to represent environment variables i.e. a map[string]string and an array of strings that match the regexp ".*=.*".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrToMap

func ArrToMap(a []string) map[string]string

ArrToMap takes an environment array of the form

["KEY1=val1", "KEY2=val2"]

and returns a corresponding map of the form

{
	"KEY1": "val1",
	"KEY2": "val2"
}

func MapToArr

func MapToArr(m map[string]string) []string

MapToArr takes an map of the form

{
	"KEY1": "val1",
	"KEY2": "val2"
}

and returns a corresponding array of the form

["KEY1=val1", "KEY2=val2"].

func ToMap

func ToMap(ss ...string) map[string]string

ToMap is a convenience function wrapping ArrToMap. It takes an environment array of the form

["KEY1=val1", "KEY2=val2"]

and returns a corresponding map of the form

{
	"KEY1": "val1",
	"KEY2": "val2"
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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