{"id":22870188,"url":"https://github.com/berquerant/mkvisitor","last_synced_at":"2025-05-07T15:24:21.676Z","repository":{"id":57633355,"uuid":"413861649","full_name":"berquerant/mkvisitor","owner":"berquerant","description":"Code generator to help implement the visitor pattern.","archived":false,"fork":false,"pushed_at":"2025-04-20T07:35:27.000Z","size":99,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-20T08:38:00.691Z","etag":null,"topics":["go"],"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/berquerant.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-05T14:52:59.000Z","updated_at":"2025-04-20T07:35:25.000Z","dependencies_parsed_at":"2023-10-11T18:53:28.191Z","dependency_job_id":"786f574e-af82-4f02-92a3-5e33a3b1c425","html_url":"https://github.com/berquerant/mkvisitor","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fmkvisitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fmkvisitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fmkvisitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fmkvisitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berquerant","download_url":"https://codeload.github.com/berquerant/mkvisitor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252903659,"owners_count":21822483,"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"],"created_at":"2024-12-13T13:14:04.784Z","updated_at":"2025-05-07T15:24:21.652Z","avatar_url":"https://github.com/berquerant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mkvisitor\n\nGiven\n\n```go\npackage example\n\ntype (\n\tNode struct{}\n\tLeaf struct{}\n)\n```\n\nrun `mkvisitor -type \"Node,Leaf\"` then generate\n\n```go\npackage example\n\nimport \"fmt\"\n\ntype Visitor interface {\n\tVisitNode(*Node)\n\tVisitLeaf(*Leaf)\n}\n\nfunc (s *Node) Accept(v Visitor) { v.VisitNode(s) }\nfunc (s *Leaf) Accept(v Visitor) { v.VisitLeaf(s) }\n\ntype VisitorDefault struct{}\n\nfunc (s *VisitorDefault) VisitNode(_ *Node) {}\nfunc (s *VisitorDefault) VisitLeaf(_ *Leaf) {}\nfunc VisitSwitch(visitor Visitor, v interface{}) {\n\tswitch v := v.(type) {\n\tcase *Node:\n\t\tvisitor.VisitNode(v)\n\tcase *Leaf:\n\t\tvisitor.VisitLeaf(v)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"VisitSwitch cannot switch %#v\", v))\n\t}\n}\n```\n\nin visitor_mkvisitor.go in the same directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fmkvisitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberquerant%2Fmkvisitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fmkvisitor/lists"}