|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -// Package storage provides structured configuration storage, and `ConfigPath` represents |
18 | | -// the hierarchical path of a configuration item. |
19 | | -// |
20 | | -// Each configuration item must have a well-defined type. The key of a configuration item |
21 | | -// (its `path`) can be split into components that form a tree structure, where each node |
22 | | -// corresponds to a part of the configuration hierarchy. |
23 | | -// |
24 | | -// The `path` serves both as the unique identifier (key) of the configuration item and |
25 | | -// as its location within the configuration tree. This design mirrors the structure of |
26 | | -// typical configuration file formats such as JSON, YAML, and TOML. |
27 | | -// |
28 | | -// A `path` is composed of only two types of elements: |
29 | | -// - Key: Represents a map key in the configuration tree. |
30 | | -// - Index: Represents an array index in the configuration tree. |
31 | | -// |
32 | | -// This approach ensures consistency, type safety, and compatibility with structured |
33 | | -// configuration formats. |
| 17 | +/* |
| 18 | +Package storage provides hierarchical configuration storage and path parsing utilities. |
| 19 | +
|
| 20 | +Features: |
| 21 | +- Storage manages key-value pairs with support for nested paths, subkey lookup, and conflict detection. |
| 22 | +- Path represents structured access paths with support for parsing (SplitPath) and construction (JoinPath). |
| 23 | +- Supports two path types: |
| 24 | + - Key (e.g., "user.name") for map access |
| 25 | + - Index (e.g., "[0]") for array access |
| 26 | +
|
| 27 | +- Maintains a tree structure (treeNode) for consistent and type-safe hierarchy management. |
| 28 | +
|
| 29 | +Use cases: |
| 30 | +- Accessing values in JSON/YAML/TOML-like configs |
| 31 | +- Managing nested config data (CRUD) |
| 32 | +- Validating structure and detecting conflicts |
| 33 | +
|
| 34 | +Notes: |
| 35 | +- Path syntax follows common config patterns (e.g., "users[0].profile.age") |
| 36 | +- Type-safe path handling (keys vs. indices) |
| 37 | +*/ |
34 | 38 | package storage |
35 | 39 |
|
36 | 40 | import ( |
|
0 commit comments