envstore

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFn

func CreateFn[T any](key string, value T) func(*Store[T]) error

func DeleteFn

func DeleteFn[T any](key string) func(*Store[T]) error

func ReadEnvFile

func ReadEnvFile(filename string) (map[string]string, error)

ReadEnvFile parses a dotenv-format file (KEY=VALUE per line, # comments supported, blank lines ignored) and returns a flat map. Lines without `=` are skipped silently. The caller is responsible for the file path.

func ReadFn

func ReadFn[T any](key string, fn func(T) error) func(*Store[T]) error

func UpdateFn

func UpdateFn[T any](key string, value T) func(*Store[T]) error

Types

type Option

type Option[T any] func(*Store[T]) error

func WithEnvFile

func WithEnvFile[T any](filename string) Option[T]

type Store

type Store[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](opts ...Option[T]) (*Store[T], error)

func (*Store[T]) Create

func (s *Store[T]) Create(key string, value T) error

func (*Store[T]) Delete

func (s *Store[T]) Delete(key string) error

func (*Store[T]) GetEnv

func (s *Store[T]) GetEnv(key string) (string, error)

func (*Store[T]) Read

func (s *Store[T]) Read(key string) (T, error)

func (*Store[T]) Update

func (s *Store[T]) Update(key string, value T) error

Jump to

Keyboard shortcuts

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