{"action":"created","issue":{"url":"https://api.github.com/repos/alanctgardner/gogen-avro/issues/17","repository_url":"https://api.github.com/repos/alanctgardner/gogen-avro","labels_url":"https://api.github.com/repos/alanctgardner/gogen-avro/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/alanctgardner/gogen-avro/issues/17/comments","events_url":"https://api.github.com/repos/alanctgardner/gogen-avro/issues/17/events","html_url":"https://github.com/alanctgardner/gogen-avro/issues/17","id":202672424,"number":17,"title":"Common interfaces","user":{"login":"rikonor","id":3395638,"avatar_url":"https://avatars.githubusercontent.com/u/3395638?v=3","gravatar_id":"","url":"https://api.github.com/users/rikonor","html_url":"https://github.com/rikonor","followers_url":"https://api.github.com/users/rikonor/followers","following_url":"https://api.github.com/users/rikonor/following{/other_user}","gists_url":"https://api.github.com/users/rikonor/gists{/gist_id}","starred_url":"https://api.github.com/users/rikonor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rikonor/subscriptions","organizations_url":"https://api.github.com/users/rikonor/orgs","repos_url":"https://api.github.com/users/rikonor/repos","events_url":"https://api.github.com/users/rikonor/events{/privacy}","received_events_url":"https://api.github.com/users/rikonor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-23T22:40:32Z","updated_at":"2017-01-25T14:15:47Z","closed_at":null,"body":"Hey Alan,\r\n\r\nI would like to discuss something with you.\r\n\r\nIt's come up that the generated code contains some things that could be better represented as interfaces. Specifically, the following two:\r\n\r\n```go\r\ntype Serializable interface {\r\n\tSerialize(w io.Writer) error\r\n}\r\n```\r\n\r\n```go\r\ntype Writer interface {\r\n\tWriteRecord(v Serializable) error\r\n\tFlush() error\r\n}\r\n```\r\n\r\nInternally, for us, it made a lot of sense to define those interfaces in another package (`avroutil`) and make some changes to the generated code that allow us to treat some of the functions more generically. Examples:\r\n\r\nChanging the function signature of Deserialize to:\r\n```go\r\nfunc(r io.Reader) (avroutil.Serializable, error)\r\n```\r\n\r\nChanging the function signature of NewContainerWriter to:\r\n```go\r\nfunc(writer io.Writer, codec string, recordsPerBlock int64) (avroutil.Writer, error)\r\n```\r\n\r\nAllows us to treat the generated Deserialize and NewContainerWriter functions as having the same type (which lets you pass them around, etc).\r\n\r\nI believe this might be beneficial to `gogen-avro` in general but it would require defining those interfaces somewhere and the generated code trying to import them, which I'm not sure if you would be interested in doing or not."},"comment":{"url":"https://api.github.com/repos/alanctgardner/gogen-avro/issues/comments/275118285","html_url":"https://github.com/alanctgardner/gogen-avro/issues/17#issuecomment-275118285","issue_url":"https://api.github.com/repos/alanctgardner/gogen-avro/issues/17","id":275118285,"user":{"login":"rikonor","id":3395638,"avatar_url":"https://avatars.githubusercontent.com/u/3395638?v=3","gravatar_id":"","url":"https://api.github.com/users/rikonor","html_url":"https://github.com/rikonor","followers_url":"https://api.github.com/users/rikonor/followers","following_url":"https://api.github.com/users/rikonor/following{/other_user}","gists_url":"https://api.github.com/users/rikonor/gists{/gist_id}","starred_url":"https://api.github.com/users/rikonor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rikonor/subscriptions","organizations_url":"https://api.github.com/users/rikonor/orgs","repos_url":"https://api.github.com/users/rikonor/repos","events_url":"https://api.github.com/users/rikonor/events{/privacy}","received_events_url":"https://api.github.com/users/rikonor/received_events","type":"User","site_admin":false},"created_at":"2017-01-25T14:15:47Z","updated_at":"2017-01-25T14:15:47Z","body":"Hey Alan,\r\n\r\nLooks great! I'll make some time over the weekend to try it out. Thanks for taking the time to make these changes."}}
{"actor":{"display_login":"rikonor"}}