From 3c054d1164eed223b65a56995d57a11637a45ce8 Mon Sep 17 00:00:00 2001 From: Thanatat Tamtan Date: Wed, 21 Dec 2022 23:24:06 +0700 Subject: [PATCH] add timestamp test --- pgstmt/update_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pgstmt/update_test.go b/pgstmt/update_test.go index 7d8e906..3bf5126 100644 --- a/pgstmt/update_test.go +++ b/pgstmt/update_test.go @@ -2,6 +2,7 @@ package pgstmt_test import ( "testing" + "time" "github.com/stretchr/testify/assert" @@ -89,6 +90,7 @@ func TestUpdate(t *testing.T) { b.Set("name").ToRaw("p.name") b.Set("address").ToRaw("p.address") b.Set("updated_at").ToRaw("now()") + b.Set("date").To(pgstmt.NotArg(time.Date(2022, 1, 2, 3, 4, 5, 6, time.UTC))) b.From("users") b.InnerJoin("profiles p").Using("email") b.Where(func(b pgstmt.Cond) { @@ -101,7 +103,8 @@ func TestUpdate(t *testing.T) { update users set name = p.name, address = p.address, - updated_at = now() + updated_at = now(), + date = '2022-01-02 03:04:05.000000006Z' from users inner join profiles p using (email) where (users.id = $1)