title: Get nil value from sql in Go
body: <p>let say I have a struct <strong>Profile</strong> and sql table <strong>profiles</strong>.</p>
  
  <pre><code>type Profile struct {
      ID        int       `json:"id"`
      CreatedAt time.Time `json:"created_at"`
      UpdatedAt time.Time `json:"updated_at"`
      FirstName string    `json:"first_name"`
      LastName  string    `json:"last_name"`
      Age       int       `json:"age"`
  }
  </code></pre>
  
  <p>And, I get a record from <strong>profiles</strong> table, assign into the Profile struct.</p>
  
  <p>These fields are <strong>allow null</strong>, so that I used <strong>sql.NullString</strong>, <strong>sql.NullInt64</strong>, <strong>pq.NullTime</strong> to check valid value before assign to struct.</p>
  
  <pre><code>// ... DB.Query(...)
  // ... rows.Next()
  // ... rows.Scan()
  // ...
  if firstName.Valid {
      p.FirstName = firstName.String
  }
  if lastName.Valid {
      p.LastName = lastName.String
  }
  if age.Valid {
      p.Age = age.Int64
  }
  // ...
  </code></pre>
  
  <p>If I have more than 10 tables, each tables has more than 30 columns, I have to check all variables again and again.
  That make ugly code, someone have any suggestion to make it pretty?</p>