{"id":43982269,"url":"https://github.com/ncodes/cstructs","last_synced_at":"2026-02-07T09:06:05.243Z","repository":{"id":57480021,"uuid":"85418008","full_name":"ncodes/cstructs","owner":"ncodes","description":"Copy values from a source struct to another similar struct.","archived":false,"fork":false,"pushed_at":"2017-03-20T09:18:51.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T06:27:38.350Z","etag":null,"topics":[],"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/ncodes.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":"2017-03-18T17:04:55.000Z","updated_at":"2017-03-19T06:39:07.000Z","dependencies_parsed_at":"2022-09-26T17:41:34.926Z","dependency_job_id":null,"html_url":"https://github.com/ncodes/cstructs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ncodes/cstructs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncodes%2Fcstructs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncodes%2Fcstructs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncodes%2Fcstructs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncodes%2Fcstructs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ncodes","download_url":"https://codeload.github.com/ncodes/cstructs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncodes%2Fcstructs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29190842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2026-02-07T09:06:04.765Z","updated_at":"2026-02-07T09:06:05.238Z","avatar_url":"https://github.com/ncodes.png","language":"Go","readme":"### CStruct \n\nCStruct copies a source struct to another struct that share similar fields\nand field types.  \n\n#### Installation\n```\ngo get github.com/ncodes/cstructs\n```\n\n#### Example\n\n```go\npackage main\n\nimport \"github.com/ncodes/cstructs\"\n\n// A\ntype A struct {\n\tName  string\n\tAge   int\n\tAbout []byte\n}\n\n// B\ntype B struct {\n\tName  string\n\tAge   int\n\tAbout []byte\n}\n\nfunc main(){ \n    \n    ben := A{\n\t\tName:  \"benedith\",\n\t\tAge:   20,\n\t\tAbout: []byte(\"Ben is a great sports person\"),\n\t}\n\n    var pete B\n    cstructs.Copy(\u0026ben, \u0026pete)\n}\n```\n\n#### CopySlice(src interface{}, dest interface{})\n\nCopies a slice of struct to another slice of struct. Both slice must have the same length.If src is empty, `nil` is returned.\n\n#### MakeSliceOf(of interface{}, size int)\n\nA convenience method for creating a slice of an initialized type. Useful when there is need to create a slice of struct to use as destination when calling `CopySlice`.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncodes%2Fcstructs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncodes%2Fcstructs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncodes%2Fcstructs/lists"}