{"id":43762131,"url":"https://github.com/kcenon/go_container_system","last_synced_at":"2026-02-05T15:08:05.879Z","repository":{"id":320852731,"uuid":"1083558340","full_name":"kcenon/go_container_system","owner":"kcenon","description":"High-performance, type-safe container framework for Go with 15 value types, message container support, and cross-language binary serialization. Provides complete binary format compatibility with C++/Rust implementations, multiple serialization formats (Binary, JSON, XML), and comprehensive test coverage.","archived":false,"fork":false,"pushed_at":"2025-12-17T14:40:40.000Z","size":194,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-21T02:44:53.370Z","etag":null,"topics":["binary-format","container","cross-platform","data-structures","framework","golang","interoperability","messaging","serialization","type-safe"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kcenon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-26T09:18:15.000Z","updated_at":"2025-12-17T14:40:41.000Z","dependencies_parsed_at":"2025-10-26T11:24:37.981Z","dependency_job_id":"dc54af79-e9cf-485e-9052-bdcb6480e832","html_url":"https://github.com/kcenon/go_container_system","commit_stats":null,"previous_names":["kcenon/go_container_system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kcenon/go_container_system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcenon%2Fgo_container_system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcenon%2Fgo_container_system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcenon%2Fgo_container_system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcenon%2Fgo_container_system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kcenon","download_url":"https://codeload.github.com/kcenon/go_container_system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcenon%2Fgo_container_system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29124793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T14:05:12.718Z","status":"ssl_error","status_checked_at":"2026-02-05T14:03:53.078Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["binary-format","container","cross-platform","data-structures","framework","golang","interoperability","messaging","serialization","type-safe"],"created_at":"2026-02-05T15:08:05.608Z","updated_at":"2026-02-05T15:08:05.874Z","avatar_url":"https://github.com/kcenon.png","language":"Go","readme":"# Go Container System\n\n[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](LICENSE)\n[![Go Version](https://img.shields.io/badge/go-1.25+-blue.svg)](https://golang.org/dl/)\n\n\u003e **Language:** **English** | [한국어](README_KO.md)\n\n## Overview\n\nThe Go Container System is a high-performance, type-safe container framework for Go that provides comprehensive data management capabilities for messaging systems and general-purpose applications. This is a Go implementation of the [C++ container_system](https://github.com/kcenon/container_system), designed to provide identical functionality while leveraging Go's strengths.\n\n## Features\n\n### Core Capabilities\n\n- **Type-Safe Value System**: 15 built-in value types with compile-time type checking\n  - null, bool, short, ushort, int, uint, long, ulong, llong, ullong\n  - float32, float64, bytes, string, container\n- **Message Container**: Full-featured message container with header support\n  - Source/Target IDs with sub-IDs\n  - Message type and version tracking\n  - Multiple serialization formats\n- **Serialization**: Multiple format support\n  - String-based serialization\n  - Byte array serialization\n  - JSON conversion\n  - XML conversion\n- **Value Operations**: Rich set of value operations\n  - Type conversions\n  - Child value management\n  - Value queries by name\n- **Container Operations**: Comprehensive container management\n  - Header manipulation\n  - Value add/remove/query\n  - Container copy (with/without values)\n  - Header swap for response messages\n- **Fluent Builder API**: ContainerBuilder pattern for readable container construction\n  - Chainable methods for source, target, type, and values\n  - Optional thread-safe mode\n- **Dependency Injection Support**: Standard interfaces and providers for DI frameworks\n  - ContainerFactory interface for easy mocking and testing\n  - Google Wire provider set for automatic wiring\n  - Compatible with Uber Dig and other DI containers\n\n## Installation\n\n```bash\ngo get github.com/kcenon/go_container_system\n```\n\n## Quick Start\n\n### Creating Simple Values\n\n```go\nimport (\n    \"github.com/kcenon/go_container_system/container/core\"\n    \"github.com/kcenon/go_container_system/container/values\"\n)\n\n// Create different value types\nboolVal := values.NewBoolValue(\"enabled\", true)\nintVal := values.NewInt32Value(\"count\", 42)\nstringVal := values.NewStringValue(\"message\", \"Hello!\")\n\n// Type conversions\nif val, err := intVal.ToInt32(); err == nil {\n    fmt.Printf(\"Value: %d\\n\", val)\n}\n```\n\n### Creating a Message Container\n\n```go\n// Create container with full header\ncontainer := core.NewValueContainerFull(\n    \"client_app\", \"instance_1\",  // Source\n    \"server_api\", \"v2\",           // Target\n    \"user_registration\",          // Message type\n)\n\n// Add values\ncontainer.AddValue(values.NewStringValue(\"username\", \"alice\"))\ncontainer.AddValue(values.NewInt32Value(\"age\", 30))\ncontainer.AddValue(values.NewStringValue(\"email\", \"alice@example.com\"))\n\n// Serialize\nserialized, _ := container.Serialize()\njsonStr, _ := container.ToJSON()\nxmlStr, _ := container.ToXML()\n```\n\n### Working with Container Values\n\n```go\n// Create a nested structure\nuserData := values.NewContainerValue(\"user\",\n    values.NewStringValue(\"name\", \"Bob\"),\n    values.NewInt32Value(\"age\", 25),\n)\n\n// Add to parent container\ncontainer.AddValue(userData)\n\n// Retrieve values\nname := container.GetValue(\"name\", 0)\nif str, err := name.ToString(); err == nil {\n    fmt.Printf(\"Name: %s\\n\", str)\n}\n```\n\n## Architecture\n\n### Package Structure\n\n```\ngo_container_system/\n├── container/\n│   ├── core/           # Core types and interfaces\n│   │   ├── value_types.go   # Value type enumeration\n│   │   ├── value.go         # Value interface and base implementation\n│   │   └── container.go     # ValueContainer implementation\n│   ├── di/             # Dependency injection support\n│   │   └── provider.go      # ContainerFactory interface and provider\n│   ├── messaging/      # Fluent builder API\n│   │   └── builder.go       # ContainerBuilder implementation\n│   └── values/         # Concrete value implementations\n│       ├── bool_value.go\n│       ├── numeric_value.go\n│       ├── string_value.go\n│       ├── bytes_value.go\n│       └── container_value.go\n├── examples/           # Usage examples\n├── tests/             # Test suites\n└── README.md\n```\n\n### Value Type Hierarchy\n\n```\nValue (interface)\n├── BaseValue (base implementation)\n│   ├── BoolValue\n│   ├── Int16Value, UInt16Value\n│   ├── Int32Value, UInt32Value\n│   ├── Int64Value, UInt64Value\n│   ├── Float32Value, Float64Value\n│   ├── StringValue\n│   ├── BytesValue\n│   └── ContainerValue\n└── ValueContainer (message container)\n```\n\n## Value Types\n\n### Numeric Types\n\n| Type | Go Type | Size | Description |\n|------|---------|------|-------------|\n| ShortValue | int16 | 2 bytes | 16-bit signed integer |\n| UShortValue | uint16 | 2 bytes | 16-bit unsigned integer |\n| IntValue | int32 | 4 bytes | 32-bit signed integer |\n| UIntValue | uint32 | 4 bytes | 32-bit unsigned integer |\n| LongValue | int32 | 4 bytes | 32-bit signed integer (compatibility) |\n| ULongValue | uint32 | 4 bytes | 32-bit unsigned integer (compatibility) |\n| LLongValue | int64 | 8 bytes | 64-bit signed integer |\n| ULLongValue | uint64 | 8 bytes | 64-bit unsigned integer |\n| FloatValue | float32 | 4 bytes | 32-bit floating point |\n| DoubleValue | float64 | 8 bytes | 64-bit floating point |\n\n### Other Types\n\n- **BoolValue**: Boolean (true/false)\n- **StringValue**: UTF-8 string\n- **BytesValue**: Binary data\n- **ContainerValue**: Nested container with child values\n- **NullValue**: Empty/null value\n\n## API Reference\n\n### Value Interface\n\n```go\ntype Value interface {\n    // Basic accessors\n    Name() string\n    Type() ValueType\n    Data() []byte\n    Size() int\n\n    // Type checking\n    IsNull() bool\n    IsBoolean() bool\n    IsNumeric() bool\n    IsString() bool\n    IsBytes() bool\n    IsContainer() bool\n\n    // Type conversions\n    ToBool() (bool, error)\n    ToInt32() (int32, error)\n    ToInt64() (int64, error)\n    ToFloat32() (float32, error)\n    ToFloat64() (float64, error)\n    ToString() (string, error)\n    ToBytes() ([]byte, error)\n\n    // Serialization\n    Serialize() (string, error)\n    ToXML() (string, error)\n    ToJSON() (string, error)\n\n    // Container operations\n    Children() []Value\n    ChildCount() int\n    GetChild(name string, index int) Value\n    AddChild(child Value) error\n    RemoveChild(name string) error\n}\n```\n\n### ValueContainer\n\n```go\n// Creation\ncontainer := core.NewValueContainer()\ncontainer := core.NewValueContainerWithType(messageType, values...)\ncontainer := core.NewValueContainerFull(sourceID, sourceSubID, targetID, targetSubID, messageType, values...)\n\n// Header operations\ncontainer.SetSource(sourceID, sourceSubID)\ncontainer.SetTarget(targetID, targetSubID)\ncontainer.SetMessageType(messageType)\ncontainer.SwapHeader()\n\n// Value operations\ncontainer.AddValue(value)\ncontainer.RemoveValue(name)\nvalue := container.GetValue(name, index)\nvalues := container.GetValues(name)\ncontainer.ClearValues()\n\n// Container operations\ncopy := container.Copy(containingValues)\n\n// Serialization\nserialized, _ := container.Serialize()\nbytes, _ := container.SerializeArray()\njson, _ := container.ToJSON()\nxml, _ := container.ToXML()\n\n// Deserialization\ncontainer.Deserialize(data)\ncontainer.DeserializeArray(bytes)\n```\n\n### ContainerBuilder (Fluent API)\n\n```go\nimport \"github.com/kcenon/go_container_system/container/messaging\"\n\n// Create container using fluent builder pattern\ncontainer, err := messaging.NewContainerBuilder().\n    WithSource(\"client\", \"1\").\n    WithTarget(\"server\", \"main\").\n    WithType(\"request\").\n    WithValues(\n        values.NewStringValue(\"action\", \"login\"),\n        values.NewStringValue(\"user\", \"alice\"),\n    ).\n    WithThreadSafe(true).\n    Build()\n```\n\n### Dependency Injection\n\n```go\nimport \"github.com/kcenon/go_container_system/container/di\"\n\n// Using ContainerFactory directly\nfactory := di.NewContainerFactory()\ncontainer := factory.NewContainer()\ncontainer = factory.NewContainerWithType(\"request\")\nbuilder := factory.NewBuilder()\n\n// Using with Google Wire\n// wire.go\n//go:build wireinject\n// +build wireinject\n\npackage main\n\nimport (\n    \"github.com/google/wire\"\n    \"github.com/kcenon/go_container_system/container/di\"\n)\n\nvar ProviderSet = wire.NewSet(\n    di.NewContainerFactory,\n    wire.Bind(new(di.ContainerFactory), new(*di.DefaultContainerFactory)),\n)\n\nfunc InitializeApp() (*App, error) {\n    wire.Build(ProviderSet, NewApp)\n    return nil, nil\n}\n\n// Using with Uber Dig\ncontainer := dig.New()\ncontainer.Provide(di.NewContainerFactory)\n```\n\n## Examples\n\nSee the [examples](examples/) directory for complete working examples:\n\n- `basic_usage.go`: Comprehensive example showing all major features\n\nRun examples:\n```bash\ngo run examples/basic_usage.go\n```\n\n## Testing\n\nRun all tests:\n```bash\ngo test ./tests -v\n```\n\nRun specific tests:\n```bash\ngo test ./tests -v -run TestBoolValue\ngo test ./tests -v -run TestValueContainer\n```\n\n## Compatibility with C++ Version\n\nThis Go implementation provides the same functionality as the C++ container_system:\n\n### Identical Features\n- ✅ 15 value types with same semantics\n- ✅ Value container with header support\n- ✅ String and byte array serialization\n- ✅ XML and JSON conversion\n- ✅ Container copy operations\n- ✅ Header swap functionality\n- ✅ Value query by name and index\n\n### Go-Specific Improvements\n- 🔹 Interface-based design for better type safety\n- 🔹 Error handling using Go idioms (error returns)\n- 🔹 Garbage collection (no manual memory management)\n- 🔹 Simplified API using Go conventions\n\n### Not Yet Implemented\n- ⏳ MessagePack serialization (planned)\n- ⏳ File load/save operations (planned)\n- ⏳ Thread-safe operations with mutexes (planned)\n- ⏳ Memory pool optimization (not needed in Go)\n\n## Project Ecosystem\n\nThis container system is designed to work with other ecosystem components:\n\n- **[container_system](https://github.com/kcenon/container_system)**: Original C++ implementation\n- **[messaging_system](https://github.com/kcenon/messaging_system)**: Message passing framework\n- **[network_system](https://github.com/kcenon/network_system)**: Network communication layer\n\n## Use Cases\n\n- **Message Passing**: Structured message containers for IPC\n- **Network Protocols**: Binary serialization for network communication\n- **Configuration**: Flexible configuration data structures\n- **Data Exchange**: Cross-language data serialization\n- **API Communication**: JSON/XML serialization for REST APIs\n\n## Performance Considerations\n\n- **Type Safety**: Compile-time type checking prevents runtime errors\n- **Memory Efficiency**: Go's garbage collector manages memory automatically\n- **Zero-Copy**: Byte slices use copy-on-write when possible\n- **Serialization**: Efficient binary serialization format\n\n## License\n\nThis project is licensed under the BSD 3-Clause License - see the LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Author\n\n**kcenon**\n- Email: kcenon@naver.com\n- GitHub: [@kcenon](https://github.com/kcenon)\n\n## Acknowledgments\n\n- Based on the C++ [container_system](https://github.com/kcenon/container_system)\n- Designed for compatibility with the messaging system ecosystem\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcenon%2Fgo_container_system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkcenon%2Fgo_container_system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcenon%2Fgo_container_system/lists"}