{"action":"created","issue":{"url":"https://api.github.com/repos/go-steem/rpc/issues/9","repository_url":"https://api.github.com/repos/go-steem/rpc","labels_url":"https://api.github.com/repos/go-steem/rpc/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/go-steem/rpc/issues/9/comments","events_url":"https://api.github.com/repos/go-steem/rpc/issues/9/events","html_url":"https://github.com/go-steem/rpc/issues/9","id":176509174,"number":9,"title":"Anything I can do to help with Database.GetBlock?","user":{"login":"faddat","id":7142025,"avatar_url":"https://avatars.githubusercontent.com/u/7142025?v=3","gravatar_id":"","url":"https://api.github.com/users/faddat","html_url":"https://github.com/faddat","followers_url":"https://api.github.com/users/faddat/followers","following_url":"https://api.github.com/users/faddat/following{/other_user}","gists_url":"https://api.github.com/users/faddat/gists{/gist_id}","starred_url":"https://api.github.com/users/faddat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faddat/subscriptions","organizations_url":"https://api.github.com/users/faddat/orgs","repos_url":"https://api.github.com/users/faddat/repos","events_url":"https://api.github.com/users/faddat/events{/privacy}","received_events_url":"https://api.github.com/users/faddat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-09-12T23:18:17Z","updated_at":"2016-10-20T12:41:28Z","closed_at":null,"body":"If there is, please let me know.  "},"comment":{"url":"https://api.github.com/repos/go-steem/rpc/issues/comments/255094550","html_url":"https://github.com/go-steem/rpc/issues/9#issuecomment-255094550","issue_url":"https://api.github.com/repos/go-steem/rpc/issues/9","id":255094550,"user":{"login":"tchap","id":697127,"avatar_url":"https://avatars.githubusercontent.com/u/697127?v=3","gravatar_id":"","url":"https://api.github.com/users/tchap","html_url":"https://github.com/tchap","followers_url":"https://api.github.com/users/tchap/followers","following_url":"https://api.github.com/users/tchap/following{/other_user}","gists_url":"https://api.github.com/users/tchap/gists{/gist_id}","starred_url":"https://api.github.com/users/tchap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchap/subscriptions","organizations_url":"https://api.github.com/users/tchap/orgs","repos_url":"https://api.github.com/users/tchap/repos","events_url":"https://api.github.com/users/tchap/events{/privacy}","received_events_url":"https://api.github.com/users/tchap/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T12:41:27Z","updated_at":"2016-10-20T12:41:27Z","body":"@faddat Actually when you use `GetBlock`, you can access the operations array, and `go-steem/rpc` is clever enough to unmarshal the operations, even though the format is weird. You can access the operations in `Block.Transactions.Operations`, e.g.\r\n\r\n```go\r\nfor _, tx := range block.Transactions {\r\n    for _, op := range tx.Operations {\r\n        processOperation(op)\r\n    }\r\n}\r\n```\r\n\r\nNow, `op` is an interface: https://godoc.org/github.com/go-steem/rpc/types#Operation . To get the underlying operation object, the data you want, you have to call `Data()` on `op`. This returns and `interface{}`, though, so you need to use a type switch to get the real object, e.g.\r\n\r\n```go\r\nfunc processOperation(op types.Operation) {\r\n    switch op := op.Data().(type) {\r\n    case *types.VoteOperations:\r\n        // Process vote_operation.\r\n    case *types.CommentOperations:\r\n        // Process comment_operation.\r\n    case ... // Add as many cases for particular operation types you need to process.\r\n    }\r\n}\r\n```\r\n\r\nYou can actually find a working example here: https://github.com/go-steem/rpc/blob/master/examples/voting_monitor/main.go#L121"}}
{"actor":{"display_login":"tchap"}}