title: How to tell gorm to save missing time.Time fields as NULL and not '0000-00-00'?
body: <p>I have this custom type for users:</p>
  <pre><code>type User struct {
      UserID    uint64 `gorm:&quot;primaryKey&quot;`
      CreatedAt time.Time
      UpdatedAt time.Time
      LastLogin time.Time
  }
  </code></pre>
  <p>When passing to gorm's <code>db.Create()</code> method, a user is initialised as follows:</p>
  <pre><code>return User{
      UserID:    userID,
      AccountID: accountID,
      UserType:  userType,
      Status:    status,
      UserInfo:  &amp;userInfo,
      CreatedAt: now,
      UpdatedAt: now,
  }
  </code></pre>
  <p>Because <code>LastLogin</code> is a nullable <code>timestamp</code> column in MySQL, I didn't initialise its value here.</p>
  <p>Now gorm will parse the unset value to <code>'0000-00-00 00:00:00.000000'</code> in the SQL statement, and cause the following error.</p>
  <pre><code>Error 2021-01-29 15:36:13,388 v1(7) error_logger.go:14 192.168.10.100 - - default - 0 Error 1292: Incorrect datetime value: '0000-00-00' for column 'last_login' at row 1
  </code></pre>
  <p>While I understand how MySQL doesn't allow zero timestamp values without having to change some modes, I can easily initialise the time.Time field to be some faraway dates, e.g. 2038-ish. How do I tell gorm to just pass the zero Time field as NULL in the SQML instead?</p>