Use NullString instead of checking for error.

This commit is contained in:
Nurahmadie 2014-03-16 11:28:55 +07:00
parent 44ffb70813
commit 7eb06fc0d5

View file

@ -326,16 +326,13 @@ func (s *sqliteDriver) getIndexDefinition(tableName string) ([]string, error) {
} }
for rows.Next() { for rows.Next() {
var sql string var sql sql.NullString
if err := rows.Scan(&sql); err != nil { if err := rows.Scan(&sql); err != nil {
// This error came from autoindex, since its sql value is null,
// we want to continue.
if strings.Contains(err.Error(), "Scan pair: <nil> -> *string") {
continue
}
return sqls, err return sqls, err
} }
sqls = append(sqls, sql) if sql.Valid {
sqls = append(sqls, sql.String)
}
} }
if err := rows.Err(); err != nil { if err := rows.Err(); err != nil {