Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Jun 15, 2023
1 parent 071156f commit e186241
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/database/sql/sql.go
Expand Up @@ -403,7 +403,6 @@ func (n NullTime) Value() (driver.Value, error) {
// } else {
// // NULL value
// }

type Null[T any] struct {
X T
Valid bool
Expand Down
6 changes: 4 additions & 2 deletions src/database/sql/sql_test.go
Expand Up @@ -1801,16 +1801,18 @@ func TestNullStringParam(t *testing.T) {
{"foo", NullString{"black", false}, nil},
}}
nullTestRun(t, spec)
}

genericSpec := nullTestSpec{"nullstring", "string", [6]nullTestRow{
func TestGenericNullStringParam(t *testing.T) {
spec := nullTestSpec{"nullstring", "string", [6]nullTestRow{
{Null[string]{"aqua", true}, "", Null[string]{"aqua", true}},
{Null[string]{"brown", false}, "", Null[string]{"", false}},
{"chartreuse", "", Null[string]{"chartreuse", true}},
{Null[string]{"darkred", true}, "", Null[string]{"darkred", true}},
{Null[string]{"eel", false}, "", Null[string]{"", false}},
{"foo", Null[string]{"black", false}, nil},
}}
nullTestRun(t, genericSpec)
nullTestRun(t, spec)
}

func TestNullInt64Param(t *testing.T) {
Expand Down

0 comments on commit e186241

Please sign in to comment.