env

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Overview

Package env provides environment variable storage with function isolation. Each function has its own isolated environment variables identified by functionID. Supports both in-memory and SQLite-backed implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message string
}

Error represents an env store error

func (*Error) Error

func (e *Error) Error() string

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

MemoryStore is an in-memory implementation of Store

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore creates a new in-memory env store

func (*MemoryStore) All

func (m *MemoryStore) All(functionID string) (map[string]string, error)

All returns all environment variables for a functionID

func (*MemoryStore) Delete

func (m *MemoryStore) Delete(functionID, key string) error

Delete removes a key-value pair for a functionID

func (*MemoryStore) Get

func (m *MemoryStore) Get(functionID, key string) (string, error)

Get retrieves a value by functionID and key

func (*MemoryStore) Set

func (m *MemoryStore) Set(functionID, key, value string) error

Set stores a key-value pair for a functionID

type SQLiteStore

type SQLiteStore struct {
	// contains filtered or unexported fields
}

SQLiteStore is a SQLite-backed implementation of Store

func NewSQLiteStore

func NewSQLiteStore(db *sql.DB) *SQLiteStore

NewSQLiteStore creates a new SQLite-backed env store

func (*SQLiteStore) All

func (s *SQLiteStore) All(functionID string) (map[string]string, error)

All returns all environment variables for a functionID

func (*SQLiteStore) Delete

func (s *SQLiteStore) Delete(functionID, key string) error

Delete removes a key-value pair for a functionID

func (*SQLiteStore) Get

func (s *SQLiteStore) Get(functionID, key string) (string, error)

Get retrieves a value by functionID and key

func (*SQLiteStore) Set

func (s *SQLiteStore) Set(functionID, key, value string) error

Set stores a key-value pair for a functionID

type Store

type Store interface {
	Get(functionID, key string) (string, error)
	Set(functionID, key, value string) error
	Delete(functionID, key string) error
	All(functionID string) (map[string]string, error)
}

Store is an interface for environment variable storage operations functionID is used to isolate env vars between functions

Jump to

Keyboard shortcuts

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