envstore

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 5 Imported by: 0

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