{"id":30288401,"url":"https://github.com/go-spring/barky","last_synced_at":"2025-08-16T22:36:45.032Z","repository":{"id":310135610,"uuid":"1038832284","full_name":"go-spring/barky","owner":"go-spring","description":"a lightweight library for hierarchical configuration storage and path parsing.","archived":false,"fork":false,"pushed_at":"2025-08-15T23:38:36.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-16T01:26:59.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-spring.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-15T22:46:09.000Z","updated_at":"2025-08-15T23:38:00.000Z","dependencies_parsed_at":"2025-08-16T01:27:04.476Z","dependency_job_id":"b60075cd-faca-45d0-b0da-1887639c4ef1","html_url":"https://github.com/go-spring/barky","commit_stats":null,"previous_names":["go-spring/barky"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/go-spring/barky","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-spring%2Fbarky","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-spring%2Fbarky/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-spring%2Fbarky/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-spring%2Fbarky/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-spring","download_url":"https://codeload.github.com/go-spring/barky/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-spring%2Fbarky/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270781211,"owners_count":24643807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-16T22:36:34.948Z","updated_at":"2025-08-16T22:36:45.012Z","avatar_url":"https://github.com/go-spring.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Barky\n\n\u003cdiv\u003e\n   \u003cimg src=\"https://img.shields.io/github/license/go-spring/barky\" alt=\"license\"/\u003e\n   \u003cimg src=\"https://img.shields.io/github/go-mod/go-version/go-spring/barky\" alt=\"go-version\"/\u003e\n   \u003cimg src=\"https://img.shields.io/github/v/release/go-spring/barky?include_prereleases\" alt=\"release\"/\u003e\n   \u003ca href=\"https://codecov.io/gh/go-spring/barky\" \u003e \n      \u003cimg src=\"https://codecov.io/gh/go-spring/barky/graph/badge.svg?token=SX7CV1T0O8\" alt=\"test-coverage\"/\u003e\n   \u003c/a\u003e\n   \u003ca href=\"https://deepwiki.com/go-spring/barky\"\u003e\u003cimg src=\"https://deepwiki.com/badge.svg\" alt=\"Ask DeepWiki\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n[English](README.md) | [中文](README_CN.md)\n\n**Barky** is a lightweight library for **hierarchical configuration storage and path parsing**, inspired by\nJSON/YAML/TOML access patterns.\n\nIt provides **type-safe path handling**, structured storage, subkey lookup, and conflict detection, making it ideal for\nmanaging nested configuration data.\n\n---\n\n## ✨ Features\n\n* **Path Parsing \u0026 Construction**\n\n    * `SplitPath`: Parse a string path into structured `Path` segments\n    * `JoinPath`: Build a string path from structured segments\n\n* **Two Path Types**\n\n    * **Key**: For map/object access (e.g., `\"user.name\"`)\n    * **Index**: For array/list access (e.g., `\"[0]\"`)\n\n* **Hierarchical Storage**\n\n    * Maintains a tree structure (`treeNode`) for type-safe paths\n    * Query subkeys with `SubKeys`\n    * Check if a path exists with `Has`\n    * Insert key-value pairs with automatic tree building and conflict detection via `Set`\n\n* **Conflict Detection**\n\n    * Detects type mismatches (e.g., when a path segment is used both as a key and as an index)\n\n* **File Source Tracking**\n\n    * Each value is associated with its source file and a file ID, useful when merging multiple configs\n\n---\n\n## 📦 Installation\n\n```bash\ngo get github.com/go-spring/barky\n```\n\n---\n\n## 🛠 Usage Examples\n\n### Path Parsing \u0026 Building\n\n```go\npath, _ := barky.SplitPath(\"users[0].profile.name\")\n// path =\u003e [ {Key:\"users\"}, {Index:\"0\"}, {Key:\"profile\"}, {Key:\"name\"} ]\n\njoined := barky.JoinPath(path)\n// joined =\u003e \"users[0].profile.name\"\n```\n\n### Storage Operations\n\n```go\ns := barky.NewStorage()\nfileID := s.AddFile(\"config.yaml\")\n\n// Insert values\ns.Set(\"users[0].profile.name\", \"Alice\", fileID)\ns.Set(\"users[0].profile.age\", \"30\", fileID)\n\n// Check existence\nexists := s.Has(\"users[0].profile.name\")\n// true\n\n// Get subkeys\nsubs, _ := s.SubKeys(\"users[0].profile\")\n// subs =\u003e [\"age\", \"name\"]\n\n// Inspect raw storage\nraw := s.RawData()\n// map[\"users[0].profile.name\"] =\u003e ValueInfo{File:0, Value:\"Alice\"}\n```\n\n---\n\n## 📖 Use Cases\n\n* **Configuration Management**\n\n    * Load and merge multiple config files (YAML/JSON/TOML)\n    * Detect and prevent structural conflicts\n\n* **Structured Data Access**\n\n    * Safely access nested values with clear key/index separation\n    * Unified path handling across maps and arrays\n\n* **Validation \u0026 Debugging**\n\n    * Check if a configuration path exists\n    * Retrieve all subkeys under a path\n\n---\n\n## ⚠️ Notes\n\n* Invalid path formats (spaces, consecutive dots, unclosed brackets, etc.) will return an error\n* Structural conflicts (e.g., `\"user.name\"` vs `\"user[0]\"`) are detected and rejected\n* `RawData` and `RawFile` expose internal state directly — use with caution\n\n---\n\n## 📜 License\n\nApache 2.0 License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-spring%2Fbarky","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-spring%2Fbarky","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-spring%2Fbarky/lists"}