{"action":"created","issue":{"url":"https://api.github.com/repos/jackc/pgx/issues/60","labels_url":"https://api.github.com/repos/jackc/pgx/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/jackc/pgx/issues/60/comments","events_url":"https://api.github.com/repos/jackc/pgx/issues/60/events","html_url":"https://github.com/jackc/pgx/issues/60","id":53300845,"number":60,"title":"pgx.NullString adding braces and \"true\"","user":{"login":"nkev","id":5410916,"avatar_url":"https://avatars.githubusercontent.com/u/5410916?v=3","gravatar_id":"","url":"https://api.github.com/users/nkev","html_url":"https://github.com/nkev","followers_url":"https://api.github.com/users/nkev/followers","following_url":"https://api.github.com/users/nkev/following{/other_user}","gists_url":"https://api.github.com/users/nkev/gists{/gist_id}","starred_url":"https://api.github.com/users/nkev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkev/subscriptions","organizations_url":"https://api.github.com/users/nkev/orgs","repos_url":"https://api.github.com/users/nkev/repos","events_url":"https://api.github.com/users/nkev/events{/privacy}","received_events_url":"https://api.github.com/users/nkev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-03T10:47:14Z","updated_at":"2015-01-03T23:28:44Z","closed_at":null,"body":"I have a nullable varchar(100) database column called \"title\" that renders fine with a Go type of \"string\" using {{.title }} in a standard HTML template via the **github.com/unrolled/render** package. But I need to account for null database values so I thought I should use pgx.NullString (with the native driver) as the model datatype. But then if the data is null, the HTML template renders the null value as  \"{ false }\". If the data is not null (e.g. \"my title\") it renders \"{my title true}\" including the braces."},"comment":{"url":"https://api.github.com/repos/jackc/pgx/issues/comments/68613887","html_url":"https://github.com/jackc/pgx/issues/60#issuecomment-68613887","issue_url":"https://api.github.com/repos/jackc/pgx/issues/60","id":68613887,"user":{"login":"nkev","id":5410916,"avatar_url":"https://avatars.githubusercontent.com/u/5410916?v=3","gravatar_id":"","url":"https://api.github.com/users/nkev","html_url":"https://github.com/nkev","followers_url":"https://api.github.com/users/nkev/followers","following_url":"https://api.github.com/users/nkev/following{/other_user}","gists_url":"https://api.github.com/users/nkev/gists{/gist_id}","starred_url":"https://api.github.com/users/nkev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkev/subscriptions","organizations_url":"https://api.github.com/users/nkev/orgs","repos_url":"https://api.github.com/users/nkev/repos","events_url":"https://api.github.com/users/nkev/events{/privacy}","received_events_url":"https://api.github.com/users/nkev/received_events","type":"User","site_admin":false},"created_at":"2015-01-03T23:28:44Z","updated_at":"2015-01-03T23:28:44Z","body":"I worked out that the [pgx.NullString struct](https://github.com/jackc/pgx/blob/master/values.go#L195) has two parameters, \"Valid\" and String\" so if I change my HTML template from {{ .Title }} to below, it works correctly. My title is only rendered if it is not null in the database: \r\n\r\n```Go\r\n  {{ if .Title.Valid }}\r\n  \t<h3>{{ .Title.String }}</h3>\r\n  {{ end }}\r\n``` \r\n\r\nSimilarly, my [pgx.NullHstore](https://github.com/jackc/pgx/blob/master/values.go#L493) \"Specs\" column also works too:\r\n\r\n```Go\r\n{{ if .Specs.Valid }}\r\n\t{{with .Specs.Hstore }}\r\n\t  <p>\r\n\t\t{{ range $key, $value := . }}\r\n\t\t   <strong>{{ $key }}</strong>: {{ $value }} <br/>\r\n\t\t{{ end }}\r\n\t  </p>\r\n\t{{end}}\r\n{{ end }}\r\n```"}}