Skip to content

Commit

Permalink
feat: add NewNull
Browse files Browse the repository at this point in the history
  • Loading branch information
qqxhb committed Oct 17, 2024
1 parent 92c1b2c commit 3729070
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions null.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func (n Null[T]) Value() (driver.Value, error) {
return n.V, nil
}

// NewNull returns a new, non-null Null.
func NewNull[T any](v T) Null[T] {
return Null[T]{V: v, Valid: true}
}

var errNilPtr = errors.New("destination pointer is nil") // embedded in descriptive error

// convertAssign is the same as convertAssignRows, but without the optional
Expand Down

0 comments on commit 3729070

Please sign in to comment.