API Reference
Complete API reference documentation for the env library.
Core API
- Package Functions - Complete list of package-level convenience functions
- Loader API - Loader type and methods
- Config API - Configuration options and presets
- SecureValue API - Secure value handling
Types and Interfaces
- Interfaces - All interface type definitions
- Constants & Errors - Constants, sentinel errors, and error types
- Component Factory - ComponentFactory and extension points
Symbol Index
The major symbols from every API reference page, grouped by function, each linking straight to its documentation. Same-named methods and package functions (e.g. GetString) get one row each under "Package-Level Functions" and "Loader Methods"; symbols marked (unexported) are internal library names that cannot be referenced through the env package.
Package-Level Functions
| Symbol | Description | Page |
|---|---|---|
Load | Init default loader | functions |
LoadWithConfig | Init with Config | functions |
ResetDefaultLoader | Reset default loader | functions |
GetString | Read string | functions |
GetInt | Read int64 | functions |
GetBool | Read bool | functions |
GetUint64 | Read uint64 | functions |
GetFloat64 | Read float64 | functions |
GetDuration | Read duration | functions |
GetSlice | Generic slice read | functions |
GetSliceFrom | Slice from instance | functions |
GetSecure | Read secret | functions |
Lookup | Key existence check | functions |
Keys | All key names | functions |
All | Full key/value map | functions |
Len | Variable count | functions |
Set | Set variable | functions |
Delete | Delete variable | functions |
Validate | Check required keys | functions |
ParseInto | Map to struct | functions |
Marshal | Serialize to string | functions |
UnmarshalMap | Parse to map | functions |
UnmarshalStruct | Parse into struct | functions |
UnmarshalInto | Fill struct from map | functions |
MarshalStruct | Struct to map | functions |
IsMarshalError | Marshal error check | functions |
Loader Methods
| Symbol | Description | Page |
|---|---|---|
New | Create Loader | loader |
LoadFiles | Load multi-format files | loader |
GetString | Read string | loader |
GetInt | Read int64 | loader |
GetBool | Read bool | loader |
GetUint64 | Read uint64 | loader |
GetFloat64 | Read float64 | loader |
GetDuration | Read duration | loader |
GetSecure | Read secret copy | loader |
Lookup | Key existence check | loader |
Set | Set variable | loader |
Delete | Delete variable | loader |
Keys | All key names | loader |
All | Full key/value map | loader |
Len | Variable count | loader |
Apply | Apply to os.Environ | loader |
IsApplied | Applied flag | loader |
LoadTime | Last load time | loader |
Config | Read-only config copy | loader |
Validate | Check required keys | loader |
ParseInto | Map to struct | loader |
Close | Close and zero | loader |
IsClosed | Closed flag | loader |
Config
| Symbol | Description | Page |
|---|---|---|
Config | Configuration struct | config |
FileConfig, ValidationConfig, LimitsConfig, JSONConfig, YAMLConfig, ParsingConfig, ComponentConfig | Seven nested sections | config |
Filenames, OverwriteExisting, MaxFileSize, KeyPattern, AuditEnabled, etc. | All config fields | config |
Validate | Validate config | config |
IsZero | Zero-value check | config |
ExpansionScope | Expansion scope enum | config |
ExpansionFileThenProcess, ExpansionFileOnly | Scope constants | config |
Presets, Factory, and Formats
| Symbol | Description | Page |
|---|---|---|
DefaultConfig | Safe defaults | config |
DevelopmentConfig | Relaxed dev preset | config |
TestingConfig | Test-isolation preset | config |
ProductionConfig | Strict prod preset | config |
ComponentFactory | Component factory type | factory |
Validator | Factory: validator | factory |
Auditor | Factory: auditor | factory |
Expander | Factory: expander | factory |
Close | Factory: release | factory |
IsClosed | Factory: closed flag | factory |
RegisterParser | Register parser | factory |
ForceRegisterParser | Override builtin | factory |
ParserFactory | Parser factory sig | factory |
DetectFormat | Detect file format | factory |
FileFormat | Format enum | factory |
FormatAuto, FormatEnv, FormatJSON, FormatYAML | Builtin format constants | factory |
String (FileFormat method) | Format name | factory |
OSFileSystem | OS implementation | factory |
DefaultFileSystem | Default instance | factory |
SecureValue and Memory Locking
| Symbol | Description | Page |
|---|---|---|
SecureValue | Secure value type | secure-value |
NewSecureValue | Create secure value | secure-value |
NewSecureValueStrict | Error on lock failure | secure-value |
String | Masked stringer | secure-value |
Reveal | Read plaintext | secure-value |
Bytes | Byte copy | secure-value |
Length | Value length | secure-value |
Masked | Masked form | secure-value |
MarshalJSON | Masked JSON output | secure-value |
MarshalText | Masked text output | secure-value |
Close | Zero, no pool return | secure-value |
Release | Zero and pool return | secure-value |
IsClosed | Closed flag | secure-value |
IsMemoryLocked | Memory lock state | secure-value |
MemoryLockError | Lock error | secure-value |
SetMemoryLockEnabled | Global lock switch | secure-value |
IsMemoryLockEnabled | Query global switch | secure-value |
SetMemoryLockStrict | Strict-mode warnings | secure-value |
IsMemoryLockStrict | Query strict mode | secure-value |
IsMemoryLockSupported | Platform support | secure-value |
Security Utilities
| Symbol | Description | Page |
|---|---|---|
ClearBytes | Zero byte slice | secure-value |
IsSensitiveKey | Sensitive key check | secure-value |
MaskValue | Mask value by key | secure-value |
MaskKey | Mask key name | secure-value |
SanitizeForLog | Log redaction | secure-value |
MaskSensitiveInString | Truncate long strings | secure-value |
Auditing
| Symbol | Description | Page |
|---|---|---|
AuditLogger | Minimal audit interface | interfaces |
FullAuditLogger | Full audit interface | interfaces |
AuditHandler | Handler interface | interfaces |
AuditEvent | Audit event struct | interfaces |
AuditAction | Action type | interfaces |
ActionLoad, ActionParse, ActionGet, ActionSet, ActionDelete, ActionValidate, ActionExpand, ActionSecurity, ActionError, ActionFileAccess | Ten action constants | interfaces |
NewJSONAuditHandler | JSON handler | factory |
NewLogAuditHandler | Stdlib-log handler | factory |
NewChannelAuditHandler | Channel handler | factory |
NewNopAuditHandler | No-op handler | factory |
NewCloseableChannelHandler, CloseableChannelHandler | Self-owned channel handler | factory |
JSONAuditHandler, LogAuditHandler, ChannelAuditHandler, NopAuditHandler | Handler implementations | interfaces |
Errors and Sentinels
| Symbol | Description | Page |
|---|---|---|
ErrFileNotFound, ErrFileTooLarge | File sentinels | constants |
ErrLineTooLong, ErrInvalidKey, ErrDuplicateKey | Parse sentinels | constants |
ErrForbiddenKey, ErrSecurityViolation, ErrInvalidValue | Security sentinels | constants |
ErrExpansionDepth | Expansion sentinel | constants |
ErrMaxVariables | Limit sentinel | constants |
ErrClosed, ErrInvalidConfig, ErrAlreadyInitialized, ErrNotInitialized, ErrMissingRequired | State sentinels | constants |
ErrValidateRequiredUnsupported | Adapter sentinel | constants |
ParseError | Parse error type | constants |
ValidationError | Validation error type | constants |
SecurityError | Security error type | constants |
FileError | File error type | constants |
ExpansionError | Expansion error type | constants |
ExpansionErrorKind, ExpansionDepthKind, ExpansionRequiredKind | Error kind constants | constants |
JSONError | JSON parse error | constants |
YAMLError | YAML parse error | constants |
MarshalError | Marshal error type | constants |
Constants and Limits
| Symbol | Description | Page |
|---|---|---|
DefaultMaxFileSize, DefaultMaxLineLength, DefaultMaxKeyLength, DefaultMaxValueLength, DefaultMaxVariables, DefaultMaxExpansionDepth | Default limit constants | constants |
DefaultKeyPattern | Default key pattern | constants |
defaultForbiddenKeys (unexported) | Builtin forbidden keys | constants |
internal.Patterns (unexported) | Sensitive key patterns | constants |
| Hard limits (unexported) | 100MB, 64KB, etc. | constants |
Interfaces
| Symbol | Description | Page |
|---|---|---|
EnvLoader | Composite loader interface | interfaces |
EnvFileLoader | File loading interface | interfaces |
EnvGetter | Read-only access interface | interfaces |
EnvSetter | Write access interface | interfaces |
EnvApplicator | Apply to system env | interfaces |
EnvCloser | Resource release interface | interfaces |
Validator | Composite validation interface | interfaces |
KeyValidator | Key validation interface | interfaces |
ValueValidator | Value validation interface | interfaces |
RequiredValidator | Required-keys interface | interfaces |
VariableExpander | Variable expansion interface | interfaces |
EnvParser | Parser interface | interfaces |
EnvStorage | Storage backend interface | interfaces |
Marshaler | Custom serialization | interfaces |
Unmarshaler | Custom deserialization | interfaces |
FileSystem | Filesystem abstraction | interfaces |
File | File operation interface | interfaces |