docs(README): update architecture diagram and enhance CLI/API tables for clarity
This commit is contained in:
@@ -10,7 +10,7 @@ Convert **env**, **YAML**, **JSON**, and **INI** to and from Go `map[string]any`
|
|||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart TB
|
||||||
Sources["Sources\nbytes reader file URL process env"]
|
Sources["Sources\nbytes reader file URL process env"]
|
||||||
Parser["Parser\ngodotenv yaml ini json"]
|
Parser["Parser\ngodotenv yaml ini json"]
|
||||||
Norm["keymap.Walk\nNormalizer"]
|
Norm["keymap.Walk\nNormalizer"]
|
||||||
@@ -84,20 +84,20 @@ os.WriteFile("out.json", b, 0o644)
|
|||||||
|
|
||||||
## CLI: `envc`
|
## CLI: `envc`
|
||||||
|
|
||||||
| Command | Purpose |
|
| Command | Purpose |
|
||||||
| --- | --- |
|
| ------------------------------------------------------------------ | --------------------------------------------------------------- |
|
||||||
| `envc convert --from yaml --to env --input - --output -` | Convert stdin YAML to dotenv on stdout |
|
| `envc convert --from yaml --to env --input - --output -` | Convert stdin YAML to dotenv on stdout |
|
||||||
| `envc get --from yaml --path service.name config.yaml` | Print one path (dot-separated; segments normalized like codecs) |
|
| `envc get --from yaml --path service.name config.yaml` | Print one path (dot-separated; segments normalized like codecs) |
|
||||||
| `envc merge --from yaml --to json --output out.json a.yaml b.yaml` | Deep-merge multiple YAML files, emit JSON |
|
| `envc merge --from yaml --to json --output out.json a.yaml b.yaml` | Deep-merge multiple YAML files, emit JSON |
|
||||||
|
|
||||||
## API (all codecs)
|
## API (all codecs)
|
||||||
|
|
||||||
| Method | Description |
|
| Method | Description |
|
||||||
| --- | --- |
|
| ----------------------------------------------- | --------------------------------- |
|
||||||
| `New(opts...)` | Construct codec |
|
| `New(opts...)` | Construct codec |
|
||||||
| `Map(ctx)` | Merged `map[string]any` |
|
| `Map(ctx)` | Merged `map[string]any` |
|
||||||
| `Unmarshal(dst)` / `UnmarshalContext(ctx, dst)` | Decode into struct (or map) |
|
| `Unmarshal(dst)` / `UnmarshalContext(ctx, dst)` | Decode into struct (or map) |
|
||||||
| `Marshal(src)` / `WriteTo(w, src)` | Encode struct or `map[string]any` |
|
| `Marshal(src)` / `WriteTo(w, src)` | Encode struct or `map[string]any` |
|
||||||
|
|
||||||
Shared options (each subpackage): `WithBytes`, `WithReader`, `WithFile`, `WithURL`, `WithHTTPHeader`, `WithHTTPClient`, `WithKeyNormalizer`, `WithSliceMerge`, `WithTrim`, `WithWeaklyTyped`, `WithTagName`, `WithDecodeHook`.
|
Shared options (each subpackage): `WithBytes`, `WithReader`, `WithFile`, `WithURL`, `WithHTTPHeader`, `WithHTTPClient`, `WithKeyNormalizer`, `WithSliceMerge`, `WithTrim`, `WithWeaklyTyped`, `WithTagName`, `WithDecodeHook`.
|
||||||
|
|
||||||
@@ -105,19 +105,19 @@ Shared options (each subpackage): `WithBytes`, `WithReader`, `WithFile`, `WithUR
|
|||||||
|
|
||||||
## Cross-format mapping
|
## Cross-format mapping
|
||||||
|
|
||||||
| Go | YAML | ENV |
|
| Go | YAML | ENV |
|
||||||
| --- | --- | --- |
|
| ------------------------- | -------------------------- | ------------------------- |
|
||||||
| `Service.SubService.Name` | `service.sub-service.name` | `SERVICE_SUBSERVICE_NAME` |
|
| `Service.SubService.Name` | `service.sub-service.name` | `SERVICE_SUBSERVICE_NAME` |
|
||||||
|
|
||||||
INI uses dotted sections, e.g. `[service.subservice]` with `name=...`.
|
INI uses dotted sections, e.g. `[service.subservice]` with `name=...`.
|
||||||
|
|
||||||
## Related libraries
|
## Related libraries
|
||||||
|
|
||||||
| Module | Role |
|
| Module | Role |
|
||||||
| --- | --- |
|
| --------------------------------------------------------- | -------------- |
|
||||||
| [go-matrix-bot](https://github.com/eSlider/go-matrix-bot) | Matrix bots |
|
| [go-matrix-bot](https://github.com/eSlider/go-matrix-bot) | Matrix bots |
|
||||||
| [go-onlyoffice](https://github.com/eSlider/go-onlyoffice) | OnlyOffice API |
|
| [go-onlyoffice](https://github.com/eSlider/go-onlyoffice) | OnlyOffice API |
|
||||||
| [go-ollama](https://github.com/eSlider/go-ollama) | Ollama client |
|
| [go-ollama](https://github.com/eSlider/go-ollama) | Ollama client |
|
||||||
|
|
||||||
## Decisions
|
## Decisions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user