{"id":36920179,"url":"https://github.com/devnw/gen","last_synced_at":"2026-01-12T16:14:29.701Z","repository":{"id":42081831,"uuid":"439615316","full_name":"devnw/gen","owner":"devnw","description":"gen is a generic general use Go functions library with the intention of replacing duplicated code where the same functionality is needed across multiple types, and provides a common interface for the functionality. The library is designed to be used in a wide variety of projects and is designed to be easy to use.","archived":false,"fork":false,"pushed_at":"2025-04-11T00:49:34.000Z","size":10856,"stargazers_count":13,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T00:47:41.382Z","etag":null,"topics":["data-structures","generic-collections","generic-functions","generic-library","generic-programming","generic-types","generics","go","golang","google-go","gophers","library","software-engineering","struct","structs","structures"],"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/devnw.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-18T12:57:38.000Z","updated_at":"2025-04-11T00:49:38.000Z","dependencies_parsed_at":"2024-04-21T18:56:52.573Z","dependency_job_id":"c67a1a29-fde8-4e41-bb36-c19a5342c853","html_url":"https://github.com/devnw/gen","commit_stats":null,"previous_names":["devnw/gen","structsdev/gen"],"tags_count":5,"template":false,"template_full_name":"devnw/oss-template","purl":"pkg:github/devnw/gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnw%2Fgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnw%2Fgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnw%2Fgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnw%2Fgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devnw","download_url":"https://codeload.github.com/devnw/gen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnw%2Fgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28342345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T15:50:39.657Z","status":"ssl_error","status_checked_at":"2026-01-12T15:49:49.297Z","response_time":98,"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":["data-structures","generic-collections","generic-functions","generic-library","generic-programming","generic-types","generics","go","golang","google-go","gophers","library","software-engineering","struct","structs","structures"],"created_at":"2026-01-12T16:14:29.631Z","updated_at":"2026-01-12T16:14:29.693Z","avatar_url":"https://github.com/devnw.png","language":"Go","readme":"# `gen` - Generic Go Utility Library\n\n[![Build \u0026 Test Action Status](https://github.com/devnw/gen/actions/workflows/build.yml/badge.svg)](https://github.com/devnw/gen/actions)\n[![Go Report Card](https://goreportcard.com/badge/go.devnw.com/gen)](https://goreportcard.com/report/go.devnw.com/gen)\n[![Go Reference](https://pkg.go.dev/badge/go.devnw.com/gen.svg)](https://pkg.go.dev/go.devnw.com/gen)\n[![License: Apache 2.0](https://img.shields.io/badge/license-Apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n\n`gen` is a generic general use Go functions library with the intention of\nreplacing duplicated code where the same functionality is needed across multiple\ntypes, and provides a common interface for the functionality.\n\nThe library is designed to be used in a wide variety of projects and is\ndesigned to be easy to use.\n\n## Installation\n\n```bash\ngo get -u go.devnw.com/gen@latest\n```\n\n## Import\n\nExample:\n\n```go\n\nimport \"go.devnw.com/gen\"\n\nfunc main() {\n    // ...\n\n    m := gen.Map[string, string]{\n        \"foo\": \"bar\",\n        \"bar\": \"baz\",\n    }\n\n    // Get a slice of map keys\n    keys := m.Keys()\n\n    // ...\n\n    slice1 := []string{\"foo\", \"bar\"}\n    slice2 := []string{\"floob\", \"bar\"}\n\n    // Call the Unique method without the `gen` prefix.\n    unique := gen.Unique(slice1, slice2)\n\n    existingmap := map[string]int{\n        \"foo\": 1223,\n        \"bar\": 111,\n    }\n\n    // Cast to the generic Map\n    m := gen.Map[string, int](existingmap)\n\n    keys = m.Keys()\n    values := m.Values()\n\n    // ...\n\n    existingSlice := []string{\"foo\", \"bar\", \"baz\"}\n\n    // Cast to the generic Slice\n    s := gen.Slice[string](existingSlice)\n\n    // Convert slice to map\n\n    m := s.Map()\n}\n\n```\n\n## Benchmarks\n\nTo execute the benchmarks, run the following command:\n\n```bash\ngo test -bench=. ./...\n```\n\nTo view benchmarks over time for the `main` branch of the repository they can\nbe seen on our [Benchmark Report Card].\n\n[Benchmark Report Card]: https://devnw.github.io/gen/dev/bench/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevnw%2Fgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevnw%2Fgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevnw%2Fgen/lists"}