{"id":27972030,"url":"https://github.com/amberpixels/abu","last_synced_at":"2025-05-07T22:37:14.581Z","repository":{"id":291080125,"uuid":"976143354","full_name":"amberpixels/abu","owner":"amberpixels","description":"A Simple Toolkit for Casting, Reflection, and Everyday Go Utilities.","archived":false,"fork":false,"pushed_at":"2025-05-01T16:18:57.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-02T09:50:44.894Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amberpixels.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-05-01T15:19:28.000Z","updated_at":"2025-05-01T16:18:46.000Z","dependencies_parsed_at":"2025-05-02T09:50:52.266Z","dependency_job_id":"04f586a2-f575-47de-b3d5-370e7d4b20ce","html_url":"https://github.com/amberpixels/abu","commit_stats":null,"previous_names":["amberpixels/abu"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amberpixels%2Fabu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amberpixels%2Fabu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amberpixels%2Fabu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amberpixels%2Fabu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amberpixels","download_url":"https://codeload.github.com/amberpixels/abu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252967971,"owners_count":21833241,"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","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-05-07T22:37:13.582Z","updated_at":"2025-05-07T22:37:14.565Z","avatar_url":"https://github.com/amberpixels.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Abu\n\nAbu — A Simple Toolkit for Casting, Reflection, and Everyday Go Utilities.\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/amberpixels/abu.svg)](https://pkg.go.dev/github.com/amberpixels/abu)\n[![Go Report Card](https://goreportcard.com/badge/github.com/amberpixels/abu)](https://goreportcard.com/report/github.com/amberpixels/abu)\n\n## Overview\n\nAbu is a Go utility library that provides helper functions for type casting, reflection, and other common programming tasks. It's designed to make your code more concise and readable, especially in testing scenarios.\n\n## Installation\n\n```bash\ngo get github.com/amberpixels/abu\n```\n\n## Features\n\n### Type Casting\n\nThe `cast` package provides functions for converting between different types:\n\n- `AsString`: Convert a value to a string\n- `AsBytes`: Convert a value to a byte slice\n- `AsBool`: Convert a value to a boolean\n- `AsInt`: Convert a value to an integer\n- `AsFloat`: Convert a value to a float\n- `AsKind`: Convert a value to a reflect.Kind\n- `AsSliceOfAny`: Convert a value to a slice of any\n- `AsStrings`: Convert a value to a slice of strings\n- `AsTime`: Convert a value to a time.Time\n\n### Type Checking\n\nThe `cast` package also provides functions for checking if a value is of a certain type:\n\n- `IsString`: Check if a value is a string (with configurable options)\n- `IsStringish`: Check if a value is string-like\n- `IsNil`: Check if a value is nil\n- `IsInt`: Check if a value is an integer\n- `IsStrings`: Check if a value is a slice of strings\n- `IsTime`: Check if a value is a time.Time\n\n### Reflection Helpers\n\nThe `reflectish` package provides helper functions for working with reflection:\n\n- `IndirectDeep`: Recursively dereference pointers\n- `LengthOf`: Get the length of various types (maps, arrays, strings, channels, slices)\n\n## Usage Examples\n\n### Type Casting\n\n```go\nimport \"github.com/amberpixels/abu/cast\"\n\n// Convert a byte slice to a string\nstr = cast.AsString([]byte(\"byte_data\")) // \"byte_data\"\n\n// Convert a custom string type\ntype CustomString string\nstr = cast.AsString(CustomString(\"example\")) // \"example\"\n\n// Convert an integer\nnum := cast.AsInt(42) // \"42\"\n\n// Convert a float\nf := cast.AsFloat(3.14) // \"3.14\"\n```\n\n### Type Checking\n\n```go\nimport \"github.com/amberpixels/abu/cast\"\n\n// Check if a value is a string\nif cast.IsString(\"example\") {\n    // It's a string\n}\n\n// Check if a value is string-like (string, []byte, etc.)\nif cast.IsStringish([]byte(\"example\")) {\n    // It's string-like\n}\n\n// Check if a value is nil\nif cast.IsNil(someValue) {\n    // It's nil\n}\n```\n\n### Reflection Helpers\n\n```go\nimport (\n    \"reflect\"\n    \"github.com/amberpixels/abu/reflect\"\n)\n\n// Recursively dereference pointers\nv := reflect.ValueOf(\u0026someValue)\nv = reflectish.IndirectDeep(v)\n\n// Get the length of a value\nlength, ok := reflectish.LengthOf(someValue)\nif ok {\n    // Length is available\n}\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famberpixels%2Fabu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famberpixels%2Fabu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famberpixels%2Fabu/lists"}