{"action":"created","issue":{"url":"https://api.github.com/repos/gocql/gocql/issues/517","labels_url":"https://api.github.com/repos/gocql/gocql/issues/517/labels{/name}","comments_url":"https://api.github.com/repos/gocql/gocql/issues/517/comments","events_url":"https://api.github.com/repos/gocql/gocql/issues/517/events","html_url":"https://github.com/gocql/gocql/issues/517","id":114545285,"number":517,"title":"Bad omitempty behaviour for UDT marshalling","user":{"login":"Gouthamve","id":7354143,"avatar_url":"https://avatars.githubusercontent.com/u/7354143?v=3","gravatar_id":"","url":"https://api.github.com/users/Gouthamve","html_url":"https://github.com/Gouthamve","followers_url":"https://api.github.com/users/Gouthamve/followers","following_url":"https://api.github.com/users/Gouthamve/following{/other_user}","gists_url":"https://api.github.com/users/Gouthamve/gists{/gist_id}","starred_url":"https://api.github.com/users/Gouthamve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gouthamve/subscriptions","organizations_url":"https://api.github.com/users/Gouthamve/orgs","repos_url":"https://api.github.com/users/Gouthamve/repos","events_url":"https://api.github.com/users/Gouthamve/events{/privacy}","received_events_url":"https://api.github.com/users/Gouthamve/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-02T08:08:21Z","updated_at":"2015-11-02T15:25:38Z","closed_at":null,"body":"omitempty on cql tags is setting the value to null even when the value exists in the struct.\r\n\r\nCQL:\r\n\r\n```cql\r\nCREATE TYPE user (\r\n    name text,\r\n    phone text,\r\n    email text\r\n);\r\n\r\nCREATE TABLE test.events_by_userid (\r\n    userid text PRIMARY KEY,\r\n    user frozen<user>\r\n);\r\n```\r\n\r\nGolang:\r\n\r\n```go\r\ntype user struct {\r\n\tName  string `cql:\"name\"`\r\n\tPhone string `cql:\"phone\"`\r\n\tEmail string `cql:\"email, omitempty\"`\r\n}\r\n\r\ntestE := user{\r\n\tName:  \"goutham\",\r\n\tPhone: \"123456\",\r\n}\r\n\r\nerr = session.Query(`INSERT INTO events_by_userid (userid , user ) VALUES ( ?, ?)`, \"goutham\", testE).Exec()\r\n```\r\n\r\nhas \r\n```cql\r\nuserid  | user\r\n---------+-------------------------------------------------\r\n goutham | {name: 'goutham', phone: '123456', email: null}\r\n```\r\n\r\nBut adding a omitempty to phone also sends a null value even if value exists.\r\n\r\n```go\r\ntype user struct {\r\n\tName  string `cql:\"name\"`\r\n\tPhone string `cql:\"phone,omitempty\"`\r\n\tEmail string `cql:\"email, omitempty\"`\r\n}\r\n\r\ntestE := user{\r\n\tName:  \"goutham\",\r\n\tPhone: \"123456\",\r\n}\r\n\r\nerr = session.Query(`INSERT INTO events_by_userid (userid , user ) VALUES ( ?, ?)`, \"goutham\", testE).Exec()\r\n```\r\n\r\ngives\r\n```cql\r\n userid  | user\r\n---------+---------------------------------------------\r\n goutham | {name: 'goutham', phone: null, email: null}\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/gocql/gocql/issues/comments/153052031","html_url":"https://github.com/gocql/gocql/issues/517#issuecomment-153052031","issue_url":"https://api.github.com/repos/gocql/gocql/issues/517","id":153052031,"user":{"login":"Zariel","id":2213,"avatar_url":"https://avatars.githubusercontent.com/u/2213?v=3","gravatar_id":"","url":"https://api.github.com/users/Zariel","html_url":"https://github.com/Zariel","followers_url":"https://api.github.com/users/Zariel/followers","following_url":"https://api.github.com/users/Zariel/following{/other_user}","gists_url":"https://api.github.com/users/Zariel/gists{/gist_id}","starred_url":"https://api.github.com/users/Zariel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zariel/subscriptions","organizations_url":"https://api.github.com/users/Zariel/orgs","repos_url":"https://api.github.com/users/Zariel/repos","events_url":"https://api.github.com/users/Zariel/events{/privacy}","received_events_url":"https://api.github.com/users/Zariel/received_events","type":"User","site_admin":false},"created_at":"2015-11-02T15:25:38Z","updated_at":"2015-11-02T15:25:38Z","body":"I am aware of the json use of it. If you want to add support for it then by all means contribute."}}