{"id":36678371,"url":"https://github.com/514366607/remap","last_synced_at":"2026-01-12T10:52:51.115Z","repository":{"id":57486893,"uuid":"134045212","full_name":"514366607/remap","owner":"514366607","description":"relationmap","archived":false,"fork":false,"pushed_at":"2018-12-05T07:19:26.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T09:09:05.628Z","etag":null,"topics":["go","index","map","relation","relationmap"],"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/514366607.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-19T08:42:09.000Z","updated_at":"2024-06-20T09:09:05.629Z","dependencies_parsed_at":"2022-09-01T23:01:17.993Z","dependency_job_id":null,"html_url":"https://github.com/514366607/remap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/514366607/remap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/514366607%2Fremap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/514366607%2Fremap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/514366607%2Fremap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/514366607%2Fremap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/514366607","download_url":"https://codeload.github.com/514366607/remap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/514366607%2Fremap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:40:25.642Z","status":"ssl_error","status_checked_at":"2026-01-12T10:39:27.820Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["go","index","map","relation","relationmap"],"created_at":"2026-01-12T10:52:51.014Z","updated_at":"2026-01-12T10:52:51.082Z","avatar_url":"https://github.com/514366607.png","language":"Go","readme":"# 关系型Map\n\n## 在写map的时候总会遇到要拿下级数据\b的情况，代码会写得很冗杂，而且lock来lock去的很烦，就直接写一个，虽然interface的效率不太好。\n\n### 其实操作在map_test.go和index_test.go里已经有详细的代码看里面就行\n```\npackage main\n\nimport (\n\t\"log\"\n\t\"remap\"\n)\n\ntype student struct {\n\tstudentID int    // 学员号\n\tname      string // 姓名\n\tsex       int8   // 性别 1男 2女\n\tage       int8   // 年龄\n\tscore     int8   // 分数\n}\n\nfunc main() {\n\n\tvar hanmeimei = student{\n\t\tstudentID: 1111,\n\t\tname:      \"韩梅梅\",\n\t\tsex:       2,\n\t\tage:       10,\n\t\tscore:     90,\n\t}\n\n\tvar lilei = student{\n\t\tstudentID: 1112,\n\t\tname:      \"李雷\",\n\t\tsex:       1,\n\t\tage:       10,\n\t\tscore:     80,\n\t}\n\n\tvar m remap.Map\n\tm.Store(\"test\", hanmeimei) // 修改操作\n\td, _ := m.Load(\"test\")     // 读取\n\tlog.Println(1, d)\n\t// 1 {1111 韩梅梅 2 10 90}\n\n\tm.Delete(\"test\")      //删除\n\td, _ = m.Load(\"test\") // 读取\n\tlog.Println(2, d)\n\t// \u003cnil\u003e\n\n\t// 创建索引\n\tm.Store(\"hanmeimei\", hanmeimei) // 修改操作\n\tm.Store(\"lilei\", lilei)         // 修改操作\n\tm.CreateIndex(\"boys\", func(k, v interface{}) bool {\n\t\tif v.(student).sex == 1 {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n\ti, _ := m.Index.GetIndex(\"boys\") // 取出索引内容\n\tlog.Println(3, i)\n\t// 3 \u0026{{true} \u003cnil\u003e {{0 0} 0 0 0 0} {{{0 0} 0 0 0 0} map[]} map[lilei:{1112 李雷 1 10 80}]}\n\n\tm.Index.DeleteIndex(\"boys\") // 删除索引\n}\n\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F514366607%2Fremap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F514366607%2Fremap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F514366607%2Fremap/lists"}