An open API service providing repository metadata for many open source software ecosystems.

Package Usage: go: fortio.org/struct2env

Package env provides conversion from structure to and from environment variables. Supports converting struct fields to environment variables using field tags, handling most data types. Provides functions to serialize structs into slices of key-value pairs where the keys are derived from struct field names transformed to upper snake case by default, or specified explicitly via struct field tags. Includes functionality to deserialize environment variables back into struct fields, handling pointers and nested structs appropriately, as well as providing shell-compatible output for environment variable definitions. Incidentally the package also defines several case conversion functions that aid in manipulating which is useful for generating or parsing environment variables, JSON tags, or command line flags style of naming (camelCase, UPPER_SNAKE_CASE, lower-kebab-case ...) The package leverages reflection to dynamically handle arbitrary struct types, and has 0 dependencies.
7 versions
Latest release: over 1 year ago
27 dependent packages

View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/fortio.org/struct2env

Dependent Repos 0