{"id":17489375,"url":"https://github.com/ake-persson/typecomp","last_synced_at":"2025-06-19T07:06:30.668Z","repository":{"id":57606503,"uuid":"131733951","full_name":"ake-persson/typecomp","owner":"ake-persson","description":"Provides comparison for different Go types and a Comparer interface when using structs","archived":false,"fork":false,"pushed_at":"2021-07-20T08:58:43.000Z","size":2380,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T10:03:34.259Z","etag":null,"topics":["cmp","go"],"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/ake-persson.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}},"created_at":"2018-05-01T16:07:59.000Z","updated_at":"2021-07-20T08:58:46.000Z","dependencies_parsed_at":"2022-09-21T01:01:11.753Z","dependency_job_id":null,"html_url":"https://github.com/ake-persson/typecomp","commit_stats":null,"previous_names":["mickep76/cmp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ake-persson/typecomp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ake-persson%2Ftypecomp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ake-persson%2Ftypecomp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ake-persson%2Ftypecomp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ake-persson%2Ftypecomp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ake-persson","download_url":"https://codeload.github.com/ake-persson/typecomp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ake-persson%2Ftypecomp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260705849,"owners_count":23049492,"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":["cmp","go"],"created_at":"2024-10-19T05:42:32.668Z","updated_at":"2025-06-19T07:06:25.634Z","avatar_url":"https://github.com/ake-persson.png","language":"Go","readme":"[![GoDoc](https://godoc.org/github.com/ake-persson/typecomp?status.svg)](https://godoc.org/github.com/ake-persson/typecomp)\n[![codecov](https://codecov.io/gh/ake-persson/typecomp/branch/master/graph/badge.svg)](https://codecov.io/gh/ake-persson/typecomp)\n[![Build Status](https://travis-ci.org/ake-persson/typecomp.svg?branch=master)](https://travis-ci.org/ake-persson/typecomp)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ake-persson/typecomp)](https://goreportcard.com/report/github.com/ake-persson/typecomp)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ake-persson/mlfmt/blob/master/LICENSE)\n\n# cmp\n\nPackage provides comparison for different Go types and a Comparer interface when using structs.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\tcmp \"github.com/ake-persson/kvstore/cmp\"\n)\n\ntype Car struct {\n\tManufacturer string\n\tModel        string\n}\n\ntype Cars []*Car\n\nfunc (c Car) String() string {\n\treturn c.Manufacturer + \" \" + c.Model\n}\n\nfunc (c Car) Eq(b interface{}) (bool, error) {\n\treturn c.String() == b.(Car).String(), nil\n}\n\nfunc (c Car) Lt(b interface{}) (bool, error) {\n\treturn c.String() \u003c b.(Car).String(), nil\n}\n\nfunc main() {\n\tcars := Cars{\n\t\t\u0026Car{\n\t\t\tManufacturer: \"Audi\",\n\t\t\tModel:        \"Q3\",\n\t\t},\n\t\t\u0026Car{\n\t\t\tManufacturer: \"Audi\",\n\t\t\tModel:        \"Q5\",\n\t\t},\n\t}\n\n\tok, err := cmp.Eq(cars[0], cars[0])\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"ok: %v\\n\", ok)\n\n\tok, err = cmp.Eq(cars[0], cars[1])\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"ok: %v\\n\", ok)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fake-persson%2Ftypecomp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fake-persson%2Ftypecomp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fake-persson%2Ftypecomp/lists"}