Add UUID helper function
UUID creates string literal expression from uuid object. uuid can be any uuid type with a String method.
This commit is contained in:
parent
256be8a406
commit
f30cbb9e89
5 changed files with 19 additions and 2 deletions
|
|
@ -78,7 +78,7 @@ func TestUUID(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.True(t, dest.StrUUID != nil)
|
||||
require.True(t, dest.UUID.String() != uuid.UUID{}.String())
|
||||
require.True(t, dest.StrUUID.String() != uuid.UUID{}.String())
|
||||
require.Equal(t, dest.StrUUID.String(), "dc8daae3-b83b-11e9-8eb4-98ded00c39c6")
|
||||
require.Equal(t, dest.StrUUID.String(), dest.BinUUID.String())
|
||||
requireLogged(t, query)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,12 @@ import (
|
|||
)
|
||||
|
||||
func TestUUIDType(t *testing.T) {
|
||||
|
||||
id := uuid.MustParse("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11")
|
||||
|
||||
query := AllTypes.
|
||||
SELECT(AllTypes.UUID, AllTypes.UUIDPtr).
|
||||
WHERE(AllTypes.UUID.EQ(String("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11")))
|
||||
WHERE(AllTypes.UUID.EQ(UUID(id)))
|
||||
|
||||
testutils.AssertDebugStatementSql(t, query, `
|
||||
SELECT all_types.uuid AS "all_types.uuid",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue