{"id":18051787,"url":"https://github.com/joegasewicz/butter","last_synced_at":"2025-04-05T07:13:52.987Z","repository":{"id":61732489,"uuid":"554496752","full_name":"joegasewicz/butter","owner":"joegasewicz","description":"Merge Go structs","archived":false,"fork":false,"pushed_at":"2022-10-20T00:25:45.000Z","size":7,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T14:53:20.313Z","etag":null,"topics":["go","structs","structs-go"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/joegasewicz/butter","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/joegasewicz.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":"2022-10-19T23:03:50.000Z","updated_at":"2023-01-25T09:51:36.000Z","dependencies_parsed_at":"2022-10-20T14:30:53.556Z","dependency_job_id":null,"html_url":"https://github.com/joegasewicz/butter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fbutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fbutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fbutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fbutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joegasewicz","download_url":"https://codeload.github.com/joegasewicz/butter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299850,"owners_count":20916193,"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","structs","structs-go"],"created_at":"2024-10-30T22:56:00.223Z","updated_at":"2025-04-05T07:13:52.954Z","avatar_url":"https://github.com/joegasewicz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Butter\nMerge Go structs\n\n### Install\n```\ngo get -u github.com/joegasewicz/butter\n```\n\n#### Merge 2 structs \u0026 return a map\nCreate a map of the combined results of two structs. The returned map\nwill merge the incoming struct on top of the original struct. \nThe returned map is useful as a value to GORM's `Updates` method for example.\n```go\ntype user struct {\n    ID   uint\n    Name string\n    Msg  string\n}\n\nincoming := user{\n    Name: \"joe\",\n}\noriginal := user{\n    ID:  1,\n    Msg: \"hello!\",\n}\nmerged := butter.MergeStructsToMap(original, incoming)\n\n// returns\n// ID -\u003e 1\n// Name -\u003e Joe\n// Description -\u003e hello!\n// Not we could pass the result to GORM's `Updates` method\ndb.Model(\u0026user).Updates(merged)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoegasewicz%2Fbutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoegasewicz%2Fbutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoegasewicz%2Fbutter/lists"}