-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support sql.Scanner & drive.Valuer
- Loading branch information
Showing
24 changed files
with
312 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package nill | ||
|
||
import ( | ||
"github.com/labstack/echo/v4" | ||
"github.com/stretchr/testify/assert" | ||
"net/http" | ||
"net/http/httptest" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/labstack/echo/v4" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
type user struct { | ||
|
@@ -92,9 +93,9 @@ func TestFromJson(t *testing.T) { | |
} | ||
|
||
assert.True(t, u.Name.Valid) | ||
assert.Equal(t, "Jon Snow", u.Name.Value) | ||
assert.Equal(t, "Jon Snow", u.Name.V) | ||
assert.True(t, u.Email.Valid) | ||
assert.Equal(t, "[email protected]", u.Email.Value) | ||
assert.Equal(t, "[email protected]", u.Email.V) | ||
}) | ||
|
||
t.Run("one of the value is null", func(t *testing.T) { | ||
|
@@ -110,9 +111,9 @@ func TestFromJson(t *testing.T) { | |
} | ||
|
||
assert.True(t, u.Name.Valid) | ||
assert.Equal(t, "Jon Snow", u.Name.Value) | ||
assert.Equal(t, "Jon Snow", u.Name.V) | ||
assert.False(t, u.Email.Valid) | ||
assert.Equal(t, "", u.Email.Value) | ||
assert.Equal(t, "", u.Email.V) | ||
}) | ||
|
||
t.Run("one of the value is empty", func(t *testing.T) { | ||
|
@@ -128,9 +129,9 @@ func TestFromJson(t *testing.T) { | |
} | ||
|
||
assert.True(t, u.Name.Valid) | ||
assert.Equal(t, "Jon Snow", u.Name.Value) | ||
assert.Equal(t, "Jon Snow", u.Name.V) | ||
assert.True(t, u.Email.Valid) | ||
assert.Equal(t, "", u.Email.Value) | ||
assert.Equal(t, "", u.Email.V) | ||
}) | ||
|
||
t.Run("only has one value", func(t *testing.T) { | ||
|
@@ -146,9 +147,9 @@ func TestFromJson(t *testing.T) { | |
} | ||
|
||
assert.True(t, u.Name.Valid) | ||
assert.Equal(t, "Jon Snow", u.Name.Value) | ||
assert.Equal(t, "Jon Snow", u.Name.V) | ||
assert.False(t, u.Email.Valid) | ||
assert.Equal(t, "", u.Email.Value) | ||
assert.Equal(t, "", u.Email.V) | ||
}) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.