NullUUID represents a UUID that may be null. NullUUID implements the SQL driver.Scanner interface so it can be used as a scan destination: var u uuid.NullUUID err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) ... if u.Valid { use u.UUID } else { NULL value }
| 27 | // } |
| 28 | // |
| 29 | type NullUUID struct { |
| 30 | UUID UUID |
| 31 | Valid bool // Valid is true if UUID is not NULL |
| 32 | } |
| 33 | |
| 34 | // Scan implements the SQL driver.Scanner interface. |
| 35 | func (nu *NullUUID) Scan(value interface{}) error { |
nothing calls this directly
no outgoing calls
no test coverage detected