{"id":29019295,"url":"https://github.com/guoquanwei/lodash-go","last_synced_at":"2025-06-26T00:10:16.402Z","repository":{"id":57572905,"uuid":"350709853","full_name":"guoquanwei/lodash-go","owner":"guoquanwei","description":"GoLang's methods package, it like javascript's lodash.","archived":false,"fork":false,"pushed_at":"2023-02-03T04:50:11.000Z","size":27,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T12:02:08.645Z","etag":null,"topics":["go","golang","lodash","method"],"latest_commit_sha":null,"homepage":"","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/guoquanwei.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":"2021-03-23T12:47:39.000Z","updated_at":"2023-12-05T06:39:44.000Z","dependencies_parsed_at":"2023-02-18T03:16:25.188Z","dependency_job_id":null,"html_url":"https://github.com/guoquanwei/lodash-go","commit_stats":null,"previous_names":["guoquanwei/lodash"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/guoquanwei/lodash-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guoquanwei%2Flodash-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guoquanwei%2Flodash-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guoquanwei%2Flodash-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guoquanwei%2Flodash-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guoquanwei","download_url":"https://codeload.github.com/guoquanwei/lodash-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guoquanwei%2Flodash-go/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261973762,"owners_count":23238589,"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":["go","golang","lodash","method"],"created_at":"2025-06-26T00:10:14.953Z","updated_at":"2025-06-26T00:10:16.358Z","avatar_url":"https://github.com/guoquanwei.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Introduction\nlodash-go is goLang methods package, it like javascript's lodash.\n\n### go doc reference\n[![GoDoc](https://godoc.org/github.com/ITcathyh/alloter?status.svg)](https://godoc.org/github.com/guoquanwei/lodash-go)\n\n### Variables\n\n```go\nfunc Chain(input interface{}) *lodash\n// init a chain\n// example: Chain([]some_struct{...})\n\nfunc Value(output interface{}) error\n// output and bind result\n// example: Chain([]some_struct{...}).some_methods().Value(\u0026result)\n\nfunc Chunk(output interface{}, input interface{}, sliceNum int) (err error)\n\nfunc Concat(output interface{}, inputs ...interface{}) (err error)\n// support concat multi arrays\n// example: Concat(\u0026result, []some_struct{...}, []some_struct{...})\n\nfunc Difference(output interface{}, input interface{}, accessory interface{}) (err error)\n// if `input`'s element in `accessory`'， will delete`.\n// example: Difference(\u0026result, []some_struct{...}, []some_struct{...})\n\nfunc Includes(input interface{}, checkValue interface{}) bool\n// check `input` contains `checkValue`.\n\nfunc IncludesBy(input interface{}, iteratee func(interface{}) bool) bool\n// check `input` contains match condition value.\n\nfunc Filter(output interface{}, input interface{}, iteratee func(interface{}) bool) (err error)\n// all match condition elements append to result.\n// example: Filter(\u0026result,[]some_struct{...}, func(v interface{}) bool { return v.(some_struct).ID \u003e 1 })\n\nfunc Every(input interface{}, iteratee func(interface{}) bool) bool\n// if all `input`'s element can be true(iteratee(element)), will return true.\n// example: Every([]some_struct{...}, func(v interface{}) bool { return v.(some_struct).ID \u003e 1 })\n\nfunc Find(output interface{}, input interface{}, iteratee func(interface{}) bool) (err error)\n// return first match condition element.\n\nfunc IndexOf(input interface{}, iteratee func(interface{}) bool) int\n// return first match condition element's index.\n\nfunc LastIndexOf(input interface{}, iteratee func(interface{}) bool) int\n// return last match condition element's index.\n\nfunc First(output interface{}, input interface{}) (err error)\n// return first element. like array[0]\n\nfunc Last(output interface{}, input interface{}) (err error)\n// return last element\n\nfunc Flatten(output interface{}, input interface{}, level int) (err error)\n// level is flatten total, if level \u003c= 0, will flatten forever.\n\nfunc ForEach(input interface{}, iteratee func(interface{})) (err error)\n// just a iterateer.\n\nfunc Map(output interface{}, input interface{}, iteratee func(interface{}) interface{}) (err error)\n// iteratee `input`'s elements and return new value.\n// example: Map(\u0026result, []some_struct{...}, func(v interface{}) interface{} {\n//   newStruct := some_Struct{}\n//   newStruct.ID = v.(some_Struct).ID + 1\n//   return newStruct\n// })\n\nfunc GroupBy(output interface{}, input interface{}, iteratee func(interface{}) (key interface{})) (err error)\n// group by iteratee function's return value.\n// args:\n//  type GroupByItem struct {\n//    Key    interface{}\n//    Values []interface{}\n//  }\n//  type GroupByRes []GroupByItem\n\n// example:\n// groups := lodash.GroupByRes{}\n// lodash.GroupBy(\u0026groups, []some_struct{...}, func(i interface{}) (key interface{}) {\n//   return i.(some_struct).ID\n// })\n\nfunc Order(output interface{}, input interface{}, keys []string, orders []string) (err error)\n// example: Order(\u0026result, []some_struct{...}, []string{`k1`, `k2`}, []string{`asc`, `desc`})\n// if len(orders) \u003c len(keys), default `asc`.\n\nfunc OrderBy(output interface{}, input interface{}, iterateers []func(interface{}) interface{}, orders []string) (err error)\n// like Order, iterateers funtion's return values is keys.\n\nfunc Sort(output interface{}, input interface{}, key string, order string) (err error)\n// like Order, but just support one key.\n\nfunc SortBy(output interface{}, input interface{}, iteratee func(interface{}) interface{}, order string) (err error)\n// like Sort, iterate funtion's return value is key.\n\nfunc Reverse(output interface{}, input interface{}) (err error)\n// reverse `input` array.\n\nfunc Uniq(output interface{}, input interface{}) (err error)\n// return Unique elements.\n\nfunc UniqBy(output interface{}, input interface{}, iteratee func(interface{}) interface{}) (err error)\n// return Unique elements by function's return value.\n\nfunc Union(output interface{}, inputs ...interface{})\n// like Concat + Uniq.\n\nfunc UnionBy(output interface{}, iteratee func(interface{}) interface{}, inputs... interface{})\n// like Concat + UniqBy.\n\nfunc Join(output interface{}, input interface{}, joinStr string) (err error)\n// array to string, each element use `joinStr` link.\n\n```\n\n### Demo\n```go\npackage main\n\nimport \"github.com/guoquanwei/lodash-go\"\n\ntype User struct {\n\tID   int\n\tName string\n}\n\nfunc main ()  {\n\t// simple method\n\tnewUsers := []User{}\n\terr1 := lodash.Filter(\u0026newUsers, []User{{ID: 1}, {ID: 2}, func(i interface{}) bool {\n\t\treturn i.(User).ID \u003e 1\n\t}})\n\n\t// multi methods use lodash.Chain()\n\tuser := User{}\n\terr2 := lodash.Chain([]User{{ID: 1}, {ID: 2}).Filter(func(i interface{}) bool {\n\t\treturn i.(User).ID \u003e 1\n\t}}).First().Value(\u0026user)\n\t\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguoquanwei%2Flodash-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguoquanwei%2Flodash-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguoquanwei%2Flodash-go/lists"}