-
Notifications
You must be signed in to change notification settings - Fork 962
Open
Labels
enhancementNew feature or requestNew feature or request
Description
What do you want to change?
Go 1.22 includes a generic Null type.
type Null[T [any](https://pkg.go.dev/builtin#any)] struct {
V T
Valid [bool](https://pkg.go.dev/builtin#bool)
}Null represents a value that may be null. Null implements the Scanner interface so it can be used as a scan destination:
var s Null[string]
err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s)
...
if s.Valid {
// use s.V
} else {
// NULL value
}
This would make our lives much easier when generating code
What database engines need to be changed?
No response
What programming language backends need to be changed?
No response
rosszurowski, mfridman, sourcec0de, iwarapter and krhubertgregoryjjb, cspeidel, shhaumb and sourcec0de
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request