Skip to content

Commit

Permalink
Deprecate null.Uint64 type and its functionality.
Browse files Browse the repository at this point in the history
Go 1.22 provides database/sql.Null[T] for all our nullable type needs:

https://pkg.go.dev/database/sql#Null
  • Loading branch information
mdwhatcott committed Jun 11, 2024
1 parent 366bdd7 commit 6001a7a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions null/uint64.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ import (
"strconv"
)

// Deprecated
var ErrScan = errors.New("converting driver.Value type")

// Deprecated
// Go 1.22 provides database/sql.Null[T] for all our nullable type needs.
// Specifically, sql.Null[uint64] covers the use case of this type.
//
// Uint64 represents an uint64 that may be null.
// Its behavior is based on the implementation of database/sql.NullInt64.
type Uint64 struct {
Uint64 uint64
Valid bool
}

// Deprecated
// Scan implements the Scanner interface.
func (n *Uint64) Scan(value any) (err error) {
if value == nil {
Expand Down Expand Up @@ -53,6 +59,7 @@ func (n *Uint64) Scan(value any) (err error) {
return fmt.Errorf("%w %T (%v) to a uint64", ErrScan, value, value)
}

// Deprecated
// Value implements the driver Valuer interface.
func (n Uint64) Value() (driver.Value, error) {
if !n.Valid {
Expand Down

0 comments on commit 6001a7a

Please sign in to comment.